ALMaSS  1.0
The Animal, Landscape and Man Simulation System
Partridge_Population_Manager Class Reference

The population manager for partridge objects. More...

#include <Partridge_Population_Manager.h>

Inheritance diagram for Partridge_Population_Manager:
Population_Manager

Public Member Functions

bool FillCoveyNeigbourList (Partridge_Covey *a_covey, int a_distance, int a_x, int a_y)
 Get a list of neighbour covies. More...
 
double TerrEvalPoly (TTypesOfLandscapeElement a_cet, int a_poly)
 Habitat evaluation. More...
 
int ClutchDensity (int x, int y, int radius)
 Returns clutch density at x,y with radius radius. More...
 
void AddStarved ()
 Record starvation event. More...
 
void WriteParAdMort (int a_min, int a_age, int a_sex, int a_cause)
 Output method. More...
 
void WriteParJuvMort (int yr, int a_min, int a_age, int a_cause)
 Output method. More...
 
void WriteParNoB (int a_min, int a_nob)
 Output method. More...
 
void WriteParUnpairedMale (int a_min, int a_num)
 Output method. More...
 
void WriteParClutches (int a_min, int a_num1, int a_num2)
 Output method. More...
 
void WriteParFlocks (int a_min, int a_size, int a_young)
 Output method. More...
 
void WriteNoHatchedPerYear (int a_min, int a_num)
 Output method. More...
 
void AddHatchSuccess (int sz)
 
More...
 
int SupplyPegPosx (int j)
 
More...
 
int SupplyPegPosy (int j)
 
More...
 
int SupplyCovPosx (int j)
 
More...
 
int SupplyCovPosy (int j)
 
More...
 
void ObjectLoopInit (int ob_type)
 
More...
 
TAnimalObjectLoopFetch (void)
 
More...
 
void CreateObjects (int ob_type, Partridge_struct *data, int number)
 
More...
 
void CreateInitialObjects (int ob_type, int number)
 
More...
 
void CreateCloneObjects (int ob_type, AdultPartridge_struct *as)
 
More...
 
void AddObject (int ob_type, TAnimal *pTAo)
 
More...
 
virtual void Init (void)
 
More...
 
 Partridge_Population_Manager (Landscape *a_map)
 
More...
 
virtual ~Partridge_Population_Manager (void)
 
More...
 
void UpdateNestingCoverMap ()
 
More...
 
double GetNestingCoverDensity (int x, int y)
 
More...
 
double GetTerrQual (int x, int y)
 
More...
 
unsigned int GetNewID ()
 
More...
 
bool SupplyShouldFlock ()
 
More...
 
void DissolveCovey (Partridge_Covey *a_covey)
 
More...
 
bool CoveyDissolveWeather ()
 
More...
 
void DoSanityCheck ()
 Debug only. More...
 
void DoMaleSanityCheck ()
 Debug only. More...
 
virtual void TheAOROutputProbe ()
 Output method. More...
 
virtual void TheRipleysOutputProbe (FILE *a_prb)
 Output method. More...
 
double GetHabitatQuality (int a_day)
 
More...
 
- Public Member Functions inherited from Population_Manager
 Population_Manager (Landscape *L)
 
virtual ~Population_Manager (void)
 
void SetNoProbes (int a_pn)
 
unsigned GetLiveArraySize (int a_listindex)
 Gets the number of 'live' objects for a list index in the TheArray. More...
 
void IncLiveArraySize (int a_listindex)
 Increments the number of 'live' objects for a list index in the TheArray. More...
 
virtual void Catastrophe (int)
 
unsigned int FarmAnimalCensus (unsigned int a_farm, unsigned int a_typeofanimal)
 
char * SpeciesSpecificReporting (int a_species, int a_time)
 
char * ProbeReport (int a_time)
 
char * ProbeReportTimed (int a_time)
 
void ImpactProbeReport (int a_Time)
 
bool BeginningOfMonth ()
 
void LOG (const char *fname)
 
int SupplyStepSize ()
 
int SupplySimW ()
 
int SupplySimH ()
 
virtual void Run (int NoTSteps)
 
virtual float Probe (int ListIndex, probe_data *p_TheProbe)
 
virtual void ImpactedProbe ()
 
int SupplyListNameLength ()
 
TAnimalSupplyAnimalPtr (int a_index, int a_animal)
 Returns the pointer indexed by a_index and a_animal. Note NO RANGE CHECK. More...
 
unsigned SupplyListIndexSize ()
 
unsigned SupplyListSize (unsigned listindex)
 
bool CheckXY (int l, int i)
 Debug method to test for out of bounds coordinates. More...
 
const char * SupplyListName (int i)
 
bool IsLast (unsigned listindex)
 
int SupplyState (unsigned listindex, unsigned j)
 
virtual void SupplyLocXY (unsigned listindex, unsigned j, int &x, int &y)
 
const char * SupplyStateNames (int i)
 
unsigned SupplyStateNamesLength ()
 
virtual void DisplayLocations ()
 
int ProbeFileInput (char *p_Filename, int p_ProbeNo)
 
TAnimalFindClosest (int x, int y, unsigned Type)
 
bool OpenTheRipleysOutputProbe (string a_NWordFilename)
 
void OpenTheAOROutputProbe (string a_AORFilename)
 
bool OpenTheMonthlyRipleysOutputProbe ()
 
bool OpenTheReallyBigProbe ()
 
virtual void TheReallyBigOutputProbe ()
 
void CloseTheMonthlyRipleysOutputProbe ()
 
virtual void CloseTheRipleysOutputProbe ()
 
virtual void CloseTheReallyBigOutputProbe ()
 
TTypesOfPopulation GetPopulationType ()
 
int GetSeasonNumber ()
 Get the season number. More...
 
void LamdaDeath (int x, int y)
 
void LamdaBirth (int x, int y)
 
void LamdaBirth (int x, int y, int z)
 
void LamdaClear ()
 
void LamdaDumpOutput ()
 
virtual bool OpenTheFledgelingProbe ()
 
virtual bool OpenTheBreedingPairsProbe ()
 
virtual bool OpenTheBreedingSuccessProbe ()
 
virtual void BreedingPairsOutput (int)
 
virtual int TheBreedingFemalesProbe (int)
 
virtual int TheFledgelingProbe ()
 
virtual void BreedingSuccessProbeOutput (double, int, int, int, int, int, int, int)
 
virtual int TheBreedingSuccessProbe (int &, int &, int &, int &, int &, int &)
 
virtual void FledgelingProbeOutput (int, int)
 
virtual void TheGeneticProbe (unsigned, int, unsigned &)
 
virtual void GeneticsResultsOutput (FILE *, unsigned)
 

Public Attributes

Partridge_Malebad_guys [500]
 Debug. More...
 
PartridgeCommunicationDatam_comms_data
 Message data. More...
 
Partridge_Communication m_messagecentre
 Message class pointer. More...
 
CoverTempMapm_territoryqualmap
 Pointer to territory quality map. More...
 
CoverTempMapm_nestingcovermap
 Pointer to nesting cover map. More...
 
k_factorsm_Ourkfactors
 Pointer to kfactors object. More...
 
int m_Starved
 No starvation events. More...
 
- Public Attributes inherited from Population_Manager
int IndexArrayX [5][10000]
 
probe_dataTheProbe [100]
 
int SimH
 
int SimW
 
unsigned SimHH
 
unsigned SimWH
 
char m_SimulationName [255]
 
bool ProbesSet
 
Landscapem_TheLandscape
 

Private Member Functions

virtual void DoFirst ()
 Utility method called before BeginStep. More...
 
virtual void DoBefore ()
 Utility method called before Step. More...
 
virtual void DoAfter ()
 Utility method called before EndStep. More...
 
virtual void DoAlmostLast ()
 Utility method called after EndStep. More...
 
virtual void DoLast ()
 Ultility method called at the end of the time-step. More...
 
void TestShouldFlock ()
 Should the birds start to flock? More...
 
void Hunting (int p_chance)
 Global hunting. More...
 
void HuntingGrid (int p_chance)
 Density grid-based hunting. More...
 
void HuntingDifferentiatedBeetleBankArea (int a_pct)
 Differentiated hunting in beetlebank areas. More...
 
void CreateNestingCoverDensityMap ()
 Intitialises the nesting cover map. More...
 
bool OpenParOutputFiles ()
 Opens the partridge output files. More...
 
bool CloseParOutputFiles ()
 Closes the partridge output files. More...
 
void FillInFoodArray ()
 Precalculated food values with age. More...
 
int HabitatEvalPolyField (int a_field)
 Part of habitat quality map evaluation. More...
 
double EvalHabitatQual (TTypesOfLandscapeElement a_cet, int a_poly)
 Part of habitat quality map evaluation. More...
 
virtual void Catastrophe ()
 Kill/clone a configuragle proportion of population. More...
 
void MaleImmigration (void)
 If male immigration is needed - Unused. More...
 

Private Attributes

unsigned int m_loop_index
 
More...
 
unsigned int m_loop_limit
 
More...
 
int m_loop_ob_type
 
More...
 
unsigned int m_Partridge_IDs
 
More...
 
bool m_ShouldFlock
 Flag for flocking or not. More...
 
int m_HatchSuccess
 No hatch success. More...
 
int m_maxx
 internal variables More...
 
int m_maxy
 
int m_halfwidth
 
FILE * ParAdMort
 Adult mortality record. More...
 
FILE * ParJuvMort
 Juvenile mortaltiy record. More...
 
FILE * ParNoB
 No of breeding Pairs. More...
 
FILE * ParClutches
 For each clutch, clutch no. & size. More...
 
FILE * ParFlocks
 Covey size 1st oct, + no. chicks. More...
 
FILE * ParUnpairedMale
 No unparied males 1st Jun. More...
 
FILE * NoHatchedPerYear
 No. successful hatches per year. More...
 
double m_HabitatQuality [300]
 Part of habitat quality map evaluation. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Population_Manager
virtual bool StepFinished ()
 Overrides the population manager StepFinished - there is no chance that hunters do not finish a step behaviour. More...
 
void EmptyTheArray ()
 Removes all objects from the TheArray by deleting them and clearing TheArray. More...
 
void SortX (unsigned Type)
 
void SortXIndex (unsigned Type)
 
void SortY (unsigned Type)
 
void SortState (unsigned Type)
 
void SortStateR (unsigned Type)
 
unsigned PartitionLiveDead (unsigned Type)
 
void Shuffle_or_Sort (unsigned Type)
 
void Shuffle (unsigned Type)
 
- Protected Attributes inherited from Population_Manager
vector< unsigned > m_LiveArraySize
 
int m_NoProbes
 
AOR_Probem_AOR_Probe
 
FILE * m_GeneticsFile
 
FILE * m_AlleleFreqsFile
 
FILE * m_EasyPopRes
 
const char * StateNames [100]
 
int m_catastrophestartyear
 
int m_StepSize
 
vector< TListOfAnimalsTheArray
 
unsigned StateNamesLength
 
const char * m_ListNames [32]
 
unsigned m_ListNameLength
 
FILE * TestFile
 
FILE * TestFile2
 
unsigned BeforeStepActions [12]
 
int m_SeasonNumber
 Holds the season number. Used when running goose and hunter sims. More...
 
TTypesOfPopulation m_population_type
 
ofstream * AOROutputPrb
 
FILE * RipleysOutputPrb
 
FILE * RipleysOutputPrb1
 
FILE * RipleysOutputPrb2
 
FILE * RipleysOutputPrb3
 
FILE * RipleysOutputPrb4
 
FILE * RipleysOutputPrb5
 
FILE * RipleysOutputPrb6
 
FILE * RipleysOutputPrb7
 
FILE * RipleysOutputPrb8
 
FILE * RipleysOutputPrb9
 
FILE * RipleysOutputPrb10
 
FILE * RipleysOutputPrb11
 
FILE * RipleysOutputPrb12
 
FILE * ReallyBigOutputPrb
 
long int lamdagrid [2][257][257]
 

Detailed Description

The population manager for partridge objects.

Constructor & Destructor Documentation

◆ Partridge_Population_Manager()

Partridge_Population_Manager::Partridge_Population_Manager ( Landscape a_map)


156  : Population_Manager( L )
157 {
158 
159  // Six lists are needed so need to remove 4 of the ten default arrays
160  // Clutches,Fledgelings,Males,Females,Flocks
161  for ( int i = 0; i < 10; i++ )
162  {
163  TheArray[i].clear();
164  }
165  for ( int i = 0; i < 4; i++ )
166  {
167  TheArray.pop_back();
168  }
169  Init();
170  m_Starved = 0;
171  /* m_Matured = 0; m_Eaten = 0; */
173 }
virtual void Init(void)
Definition: Partridge_Population_Manager.cpp:207
int m_Starved
No starvation events.
Definition: Partridge_Population_Manager.h:171
PartridgeCommunicationData * m_comms_data
Message data.
Definition: Partridge_Population_Manager.h:161
Population_Manager(Landscape *L)
Definition: PopulationManager.cpp:221
vector< TListOfAnimals > TheArray
Definition: PopulationManager.h:534
Data structure of a message.
Definition: Partridge_Communication.h:78

References Init(), m_comms_data, m_Starved, and Population_Manager::TheArray.

◆ ~Partridge_Population_Manager()

Partridge_Population_Manager::~Partridge_Population_Manager ( void  )
virtual


178 {
180  delete m_Ourkfactors;
181  delete m_territoryqualmap;
182  delete m_nestingcovermap;
183  delete m_comms_data;
184 }
CoverTempMap * m_territoryqualmap
Pointer to territory quality map.
Definition: Partridge_Population_Manager.h:165
k_factors * m_Ourkfactors
Pointer to kfactors object.
Definition: Partridge_Population_Manager.h:169
bool CloseParOutputFiles()
Closes the partridge output files.
Definition: Partridge_Population_Manager.cpp:1631
CoverTempMap * m_nestingcovermap
Pointer to nesting cover map.
Definition: Partridge_Population_Manager.h:167

References CloseParOutputFiles(), m_comms_data, m_nestingcovermap, m_Ourkfactors, and m_territoryqualmap.

Member Function Documentation

◆ AddHatchSuccess()

void Partridge_Population_Manager::AddHatchSuccess ( int  sz)
inline


228  {
229  m_HatchSuccess += sz;
230  }
int m_HatchSuccess
No hatch success.
Definition: Partridge_Population_Manager.h:127

References m_HatchSuccess.

Referenced by Partridge_Clutch::ClDeveloping().

◆ AddObject()

void Partridge_Population_Manager::AddObject ( int  ob_type,
TAnimal pTAo 
)


458 {
459  TheArray[ob_type].push_back( pTAo );
460 }

References Population_Manager::TheArray.

Referenced by Partridge_Covey::Partridge_Covey().

◆ AddStarved()

void Partridge_Population_Manager::AddStarved ( )
inline

Record starvation event.

186  {
187  m_Starved++;
188  }

References m_Starved.

◆ Catastrophe()

void Partridge_Population_Manager::Catastrophe ( void  )
privatevirtual

Kill/clone a configuragle proportion of population.

This version simply alters populations on 1st January - it is very dangerous to add individuals in many of the models so beware!!!!
4th October 2007 - Implemented only to work with ADULT Males and Females

Reimplemented from Population_Manager.

1731  {
1736  //
1737  // First do we have the right day?
1738  int today = m_TheLandscape->SupplyDayInYear();
1739  if (today!=1) return;
1740  // First do we have the right year?
1742  if (year%cfg_pm_eventfrequency.value()!=0) return;
1743 
1744  Partridge_Male* PM = NULL; // assignment to get rid of warning
1745  Partridge_Female* PF = NULL;
1746  Partridge_Base* PB = NULL;
1747  // Now if the % decrease is higher or lower than 100 we need to do different things
1748  int esize=cfg_pm_eventsize.value();
1749  if (esize<100) {
1750  unsigned size2 = (unsigned) TheArray[ pob_Male ].size();
1751  for ( unsigned j = 0; j < size2; j++ ) {
1752  if (random(100) > esize) {
1753  PM = dynamic_cast < Partridge_Male * > ( TheArray[ pob_Male ] [ j ] );
1754  PM->SetState(pars_MDying); // Kill it
1755  }
1756  }
1757  size2 = (unsigned) TheArray[ pob_Female ].size();
1758  for ( unsigned j = 0; j < size2; j++ ) {
1759  if (random(100) > esize) {
1760  PF = dynamic_cast < Partridge_Female * > ( TheArray[ pob_Female ] [ j ] );
1761  PF->SetState(pars_FDying); // Kill it
1762  }
1763  }
1764  } else if (esize>100) {
1765  // This is a tricky thing to do because we need to duplicate birds, but dare not mess
1766  // mate pointers etc up.
1767  // This also requires a copy method in the target birds
1768  // esize also needs translating 120 = 20%, 200 = 100%
1769  if (esize<200) {
1770  esize-=100;
1771  unsigned size2;
1772  size2 = (unsigned) TheArray[ pob_Male ].size();
1773  for ( unsigned j = 0; j < size2; j++ ) {
1774  if (random(100) < esize) {
1775  PB = dynamic_cast < Partridge_Base * > ( TheArray[ pob_Male ] [ j ] );
1776  PB->CopyMyself(pob_Male); // Duplicate it
1777  }
1778  }
1779  size2 = (unsigned) TheArray[ pob_Female ].size();
1780  for ( unsigned j = 0; j < size2; j++ ) {
1781  if (random(100) < esize) {
1782  PB = dynamic_cast < Partridge_Base * > ( TheArray[ pob_Female ] [ j ] );
1783  PB->CopyMyself(pob_Female); // Duplicate it
1784  }
1785  }
1786  } else {
1787  esize-=100;
1788  esize/=100; // this will throw away fractional parts so will get 1, 2, 3 from 200, 350 400
1789  unsigned size2;
1790  size2 = (unsigned) TheArray[ pob_Male ].size();
1791  for ( unsigned j = 0; j < size2; j++ ) {
1792  for ( int e=0; e<esize; e++) {
1793  PB = dynamic_cast < Partridge_Base * > ( TheArray[ pob_Male ] [ j ] );
1794  PB->CopyMyself(pob_Male); // Duplicate it
1795  }
1796  }
1797  size2 = (unsigned) TheArray[ pob_Female ].size();
1798  for ( unsigned j = 0; j < size2; j++ ) {
1799  for ( int e=0; e<esize; e++) {
1800  PB = dynamic_cast < Partridge_Base * > ( TheArray[ pob_Female ] [ j ] );
1801  PB->CopyMyself(pob_Female); // Duplicate it
1802  }
1803  }
1804  }
1805  }
1806  else return; // No change so do nothing
1807 }
int random(int a_range)
Definition: ALMaSS_CmdLine.cpp:142
@ pars_MDying
Definition: Partridge_All.h:279
@ pars_FDying
Definition: Partridge_All.h:283
@ pob_Female
Definition: Partridge_All.h:297
@ pob_Male
Definition: Partridge_All.h:297
CfgInt cfg_pm_eventsize
CfgInt cfg_pm_eventfrequency
int value(void)
Definition: configurator.h:98
int SupplyYearNumber(void)
Definition: landscape.h:1616
int SupplyDayInYear(void)
Definition: landscape.h:1596
Base class for all partridge classes.
Definition: Partridge_All.h:401
virtual void CopyMyself(int a_Ptype)
Duplicate this object.
Definition: Partridge_All.cpp:239
void SetState(Partridge_State a_pars)
Set state.
Definition: Partridge_All.h:462
The partridge female class.
Definition: Partridge_All.h:770
The partridge male class.
Definition: Partridge_All.h:657
int m_catastrophestartyear
Definition: PopulationManager.h:532
Landscape * m_TheLandscape
Definition: PopulationManager.h:515

References cfg_pm_eventfrequency, cfg_pm_eventsize, Partridge_Base::CopyMyself(), Population_Manager::m_catastrophestartyear, Population_Manager::m_TheLandscape, pars_FDying, pars_MDying, pob_Female, pob_Male, random(), Partridge_Base::SetState(), Landscape::SupplyDayInYear(), Landscape::SupplyYearNumber(), Population_Manager::TheArray, and CfgInt::value().

◆ CloseParOutputFiles()

bool Partridge_Population_Manager::CloseParOutputFiles ( )
private

Closes the partridge output files.

1632 {
1633  /* FILE * fff = fopen( "MeanFoodPerday.txt", "w" );
1634 
1635  fprintf( fff, "%g\n", debug_totalfood / debug_totaldays ); fprintf( fff, "Starved Chicks %d\n", m_Starved );
1636  fprintf( fff, "Eaten Chicks %d\n", m_Eaten ); fprintf( fff, "Matured Chicks %d\n", m_Matured );
1637  fprintf( fff, "Eaten Clutches %d\n", m_EatenE ); fprintf( fff, "Matured Clutches %d\n", m_MaturedE ); fclose( fff ); */
1638  fclose( ParAdMort );
1639  fclose( ParJuvMort );
1640  fclose( ParNoB );
1641  fclose( ParClutches );
1642  fclose( ParFlocks );
1643  fclose( ParUnpairedMale );
1644  fclose( NoHatchedPerYear );
1645  FILE * idb = fopen("k_facInfoBase.txt", "a" );
1646  if (!idb) {
1647  g_msg->Warn( "k_factors::DumpInfoDatabase","Cannot open k_facInfoBase.txt" );
1648  exit( 1 );
1649  }
1650  fprintf( idb, "0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\n");
1651  fclose( idb );
1652 #ifdef __NESTPOSITIONS_OUT
1653  fclose(NestPositions);
1654 #endif
1655  return true;
1656 }
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: maperrormsg.cpp:59
FILE * NoHatchedPerYear
No. successful hatches per year.
Definition: Partridge_Population_Manager.h:144
FILE * ParUnpairedMale
No unparied males 1st Jun.
Definition: Partridge_Population_Manager.h:142
FILE * ParNoB
No of breeding Pairs.
Definition: Partridge_Population_Manager.h:136
FILE * ParClutches
For each clutch, clutch no. & size.
Definition: Partridge_Population_Manager.h:138
FILE * ParJuvMort
Juvenile mortaltiy record.
Definition: Partridge_Population_Manager.h:134
FILE * ParFlocks
Covey size 1st oct, + no. chicks.
Definition: Partridge_Population_Manager.h:140
FILE * ParAdMort
Adult mortality record.
Definition: Partridge_Population_Manager.h:132
class MapErrorMsg * g_msg
This pointer provides access the to the internal ALMaSS error message system.
Definition: maperrormsg.cpp:41

References g_msg, NoHatchedPerYear, ParAdMort, ParClutches, ParFlocks, ParJuvMort, ParNoB, ParUnpairedMale, and MapErrorMsg::Warn().

Referenced by ~Partridge_Population_Manager().

◆ ClutchDensity()

int Partridge_Population_Manager::ClutchDensity ( int  x,
int  y,
int  radius 
)

Returns clutch density at x,y with radius radius.

570 {
571  // Counts the number of clutches that are within 500m of x,y
572  int result = 0;
573  AnimalPosition ap;
574  int sz = (int)TheArray[pob_Clutch].size();
575  for ( int c = 0; c < sz; c++ )
576  {
577  ap = TheArray[pob_Clutch] [c]->SupplyPosition();
578  if ( ( ( abs( ( int )( ap.m_x - x ) ) % m_halfwidth ) < radius )
579  && ( ( abs( ( int )( ap.m_y - y ) ) % m_halfwidth ) < radius ) )result++;
580  }
581  return result;
582 }
@ pob_Clutch
Definition: Partridge_All.h:297
A class defining an animals position.
Definition: PopulationManager.h:170
unsigned m_x
Definition: PopulationManager.h:172
unsigned m_y
Definition: PopulationManager.h:173
int m_halfwidth
Definition: Partridge_Population_Manager.h:129

References m_halfwidth, AnimalPosition::m_x, AnimalPosition::m_y, pob_Clutch, and Population_Manager::TheArray.

Referenced by Partridge_Female::FIncubating().

◆ CoveyDissolveWeather()

bool Partridge_Population_Manager::CoveyDissolveWeather ( )


Unused at present.

1423 {
1424  /* // The aim here is to get covey dissolve after 31st Jan, when we have a 5 day
1425  // period with temp above 5 (mean) and rainfall <2mm long int d1 = m_TheLandscape->SupplyGlobalDate();
1426  for ( int i = 0; i < 5; i++ ) { if ( m_TheLandscape->SupplyTemp( d1 - i ) < 2.5 ) return false;
1427  // if ( m_TheLandscape->SupplyRain( d1 - i ) >= 2.0 ) return false; } // No wet or cold days so all OK */
1428  return true;
1429 }

Referenced by TestShouldFlock().

◆ CreateCloneObjects()

void Partridge_Population_Manager::CreateCloneObjects ( int  ob_type,
AdultPartridge_struct as 
)


536 {
537  Partridge_Male * New_Male;
538  Partridge_Female * New_Female;
539  Partridge_Covey * New_Flock;
540 
541  if ( as->sex ) // Male
542  {
543  // Male
544  New_Male = new Partridge_Male( as->bx, as->by, as->x, as->y, NULL, m_TheLandscape, as->family_counter, this );
545  TheArray[ob_type].push_back( New_Male );
546  New_Flock = new Partridge_Covey( New_Male, this, New_Male->Supply_m_Location_x(), New_Male->Supply_m_Location_y(), m_TheLandscape );
547  New_Male->SetCovey( New_Flock );
548  // Must now set age.
549  New_Male->SetAge(as->age);
550  }
551  else // Female
552  {
553  // Female
554  New_Female = new Partridge_Female( as->bx, as->by, as->x, as->y, NULL, m_TheLandscape, as->family_counter, this );
555  TheArray[ob_type].push_back( New_Female );
556  New_Flock = new Partridge_Covey( New_Female, this, New_Female->Supply_m_Location_x(), New_Female->Supply_m_Location_y(), m_TheLandscape );
557  New_Female->SetCovey( New_Flock );
558  // Must now set age.
559  New_Female->SetAge(as->age);
560  }
561 }
int age
Definition: Partridge_All.h:389
bool sex
Definition: Partridge_All.h:388
void SetCovey(Partridge_Covey *a_covey)
Set covey pointer.
Definition: Partridge_All.h:492
void SetAge(int a_age)
Set age.
Definition: Partridge_All.h:477
The collective for a family of partridges
Definition: Partridge_Covey.h:90
int by
Definition: Partridge_All.h:347
int x
Definition: Partridge_All.h:344
int bx
Definition: Partridge_All.h:346
int y
Definition: Partridge_All.h:345
int family_counter
Definition: Partridge_All.h:350
int Supply_m_Location_x()
Definition: PopulationManager.h:213
int Supply_m_Location_y()
Definition: PopulationManager.h:216

References AdultPartridge_struct::age, Partridge_struct::bx, Partridge_struct::by, Partridge_struct::family_counter, Population_Manager::m_TheLandscape, Partridge_Base::SetAge(), Partridge_Base::SetCovey(), AdultPartridge_struct::sex, TAnimal::Supply_m_Location_x(), TAnimal::Supply_m_Location_y(), Population_Manager::TheArray, Partridge_struct::x, and Partridge_struct::y.

Referenced by Partridge_Base::CopyMyself().

◆ CreateInitialObjects()

void Partridge_Population_Manager::CreateInitialObjects ( int  ob_type,
int  number 
)


466 {
467  Partridge_Male * New_Male;
468  Partridge_Female * New_Female;
469  Partridge_Covey * New_Flock;
470 
471  int extentx = m_TheLandscape->SupplySimAreaWidth();
472  int extenty = m_TheLandscape->SupplySimAreaHeight();
473 
474  for ( int i = 0; i < number; i++ )
475  {
476  unsigned x = 0;
477  unsigned y = 0;
478  bool OK=false;
479  while (!OK) {
480  x = random( extentx );
481  y = random( extenty );
483  switch (ele) {
484  case tole_StoneWall:
485  case tole_Fence:
486  case tole_Garden:
487  case tole_Building:
488  case tole_Pond:
489  case tole_Freshwater:
490  case tole_River:
491  case tole_Saltwater:
492  case tole_Coast:
493  case tole_BareRock:
494  case tole_AmenityGrass:
495  case tole_Parkland:
496  case tole_UrbanNoVeg:
497  case tole_UrbanPark:
499  case tole_SandDune:
500  case tole_Copse:
501  case tole_MetalledPath:
502  case tole_Carpark:
503  case tole_Churchyard:
504  case tole_Saltmarsh:
505  case tole_Stream:
506  case tole_HeritageSite:
507  break;
508  default: OK=true;
509  break;
510  }
511 
512  }
513  if ( ob_type == pob_Male ) // Male
514  {
515  // Male
516  New_Male = new Partridge_Male( 0, 0, x , y, NULL, m_TheLandscape, random( 1000000 ), this );
517  TheArray[ob_type].push_back( New_Male );
518 
519  New_Flock = new Partridge_Covey( New_Male, this, New_Male->Supply_m_Location_x(), New_Male->Supply_m_Location_y(), m_TheLandscape );
520  New_Male->SetCovey( New_Flock );
521  }
522  if ( ob_type == pob_Female ) // Female
523  {
524  New_Female = new Partridge_Female( 0, 0, x , y, NULL, m_TheLandscape, random( 1000000 ), this );
525  TheArray[ob_type].push_back( New_Female );
526  New_Flock = new Partridge_Covey( New_Female, this, New_Female->Supply_m_Location_x(), New_Female->Supply_m_Location_y(), m_TheLandscape );
527  New_Female->SetCovey( New_Flock );
528  }
529  }
530 }
int SupplySimAreaHeight(void)
Definition: landscape.h:1637
int SupplySimAreaWidth(void)
Definition: landscape.h:1632
TTypesOfLandscapeElement SupplyElementType(int a_polyref)
Definition: landscape.h:1110
TTypesOfLandscapeElement
Definition: tole_declaration.h:36
@ tole_BareRock
Definition: tole_declaration.h:75
@ tole_Saltmarsh
Definition: tole_declaration.h:88
@ tole_Carpark
Definition: tole_declaration.h:85
@ tole_Coast
Definition: tole_declaration.h:67
@ tole_UrbanNoVeg
Definition: tole_declaration.h:78
@ tole_Stream
Definition: tole_declaration.h:89
@ tole_Saltwater
Definition: tole_declaration.h:66
@ tole_HeritageSite
Definition: tole_declaration.h:90
@ tole_River
Definition: tole_declaration.h:65
@ tole_StoneWall
Definition: tole_declaration.h:56
@ tole_Parkland
Definition: tole_declaration.h:77
@ tole_UrbanPark
Definition: tole_declaration.h:79
@ tole_Garden
Definition: tole_declaration.h:58
@ tole_Pond
Definition: tole_declaration.h:101
@ tole_Fence
Definition: tole_declaration.h:57
@ tole_Copse
Definition: tole_declaration.h:82
@ tole_Freshwater
Definition: tole_declaration.h:64
@ tole_Building
Definition: tole_declaration.h:62
@ tole_Churchyard
Definition: tole_declaration.h:86
@ tole_BuiltUpWithParkland
Definition: tole_declaration.h:80
@ tole_AmenityGrass
Definition: tole_declaration.h:76
@ tole_SandDune
Definition: tole_declaration.h:81
@ tole_MetalledPath
Definition: tole_declaration.h:84

References Population_Manager::m_TheLandscape, pob_Female, pob_Male, random(), Partridge_Base::SetCovey(), TAnimal::Supply_m_Location_x(), TAnimal::Supply_m_Location_y(), Landscape::SupplyElementType(), Landscape::SupplySimAreaHeight(), Landscape::SupplySimAreaWidth(), Population_Manager::TheArray, tole_AmenityGrass, tole_BareRock, tole_Building, tole_BuiltUpWithParkland, tole_Carpark, tole_Churchyard, tole_Coast, tole_Copse, tole_Fence, tole_Freshwater, tole_Garden, tole_HeritageSite, tole_MetalledPath, tole_Parkland, tole_Pond, tole_River, tole_Saltmarsh, tole_Saltwater, tole_SandDune, tole_StoneWall, tole_Stream, tole_UrbanNoVeg, and tole_UrbanPark.

Referenced by Init().

◆ CreateNestingCoverDensityMap()

void Partridge_Population_Manager::CreateNestingCoverDensityMap ( )
private

Intitialises the nesting cover map.

779 {
780  // Doing this by brute force takes forever, so this is done by creating a
781  // temporary map of covers first
782  //
785  CoverTempMap * tm;
786  tm = new CoverTempMap(lx, ly);
787  tm->ZeroQual();
789  double area;
791  for ( int i = 0; i < lx; i++ )
792  {
793  for ( int j = 0; j < ly; j++ )
794  {
795  tole = m_TheLandscape->SupplyElementType( i, j );
796  // Add the value of this cell to the qualmap
798  switch ( tole )
799  {
800  // case tole_Hedges:
801  // case tole_FieldBoundary:
802  case tole_HedgeBank:
803  // No good if it is sub-type 0
804  if ( m_TheLandscape->SupplyElementSubType( i, j ) > 0 )
805  {
806  tm->AddQual(i,j,1);
807  }
808  break;
809  default:
810  break;
811  }
812  }
813  }
814  // Now we can do the real job
815  // Create a grid of 10x10 squares (default for CoverTempMap)
816  // loop through the grid
817  for ( int i = 0; i < m_maxx; i++ )
818  {
819  for ( int j = 0; j < m_maxy; j++ )
820  {
821  // Needs the values for the 1km square we are in. (1000/8 = 125, so need to look at 125*125 squares)
822  area = 0;
823  for ( int ii = -50; ii < 50; ii++ )
824  {
825  for ( int jj = -50; jj < 50; jj++ )
826  area += tm->GetQualIndexed(( m_maxx + i + ii ) % m_maxx,( m_maxy + j + jj ) % m_maxy);
827  }
828  // Assume the mean width of useful habitat is 2.44m and per km (excl. trees)
829  m_nestingcovermap->SetQualIndexed(i,j,area/3132);
830  }
831  }
832  delete tm;
833 }
For storing assessed habitat quality.
Definition: Partridge_Population_Manager.h:68
void AddQual(int a_x, int a_y, double a_qual)
Definition: Partridge_Population_Manager.h:77
void SetQualIndexed(int a_x, int a_y, double a_qual)
Definition: Partridge_Population_Manager.h:79
double GetQualIndexed(int a_x, int a_y)
Definition: Partridge_Population_Manager.h:78
void ZeroQual()
Definition: Partridge_Population_Manager.h:74
int SupplyPolyRef(int a_x, int a_y)
Definition: landscape.h:1488
int SupplyElementSubType(int a_polyref)
Definition: landscape.h:1121
double EvalHabitatQual(TTypesOfLandscapeElement a_cet, int a_poly)
Part of habitat quality map evaluation.
Definition: Partridge_Population_Manager.cpp:837
int m_maxy
Definition: Partridge_Population_Manager.h:129
int m_maxx
internal variables
Definition: Partridge_Population_Manager.h:129
@ tole_HedgeBank
Definition: tole_declaration.h:68

References CoverTempMap::AddQual(), EvalHabitatQual(), CoverTempMap::GetQualIndexed(), m_maxx, m_maxy, m_nestingcovermap, m_territoryqualmap, Population_Manager::m_TheLandscape, CoverTempMap::SetQualIndexed(), Landscape::SupplyElementSubType(), Landscape::SupplyElementType(), Landscape::SupplyPolyRef(), Landscape::SupplySimAreaHeight(), Landscape::SupplySimAreaWidth(), tole_HedgeBank, and CoverTempMap::ZeroQual().

Referenced by Init().

◆ CreateObjects()

void Partridge_Population_Manager::CreateObjects ( int  ob_type,
Partridge_struct data,
int  number 
)


369 {
370  Partridge_Clutch * New_Clutch;
371  Partridge_Chick * New_Chick;
372  Partridge_Chick2 * New_Chick2;
373  Partridge_Male * New_Male;
374  Partridge_Female * New_Female;
375  Partridge_Covey * New_Flock;
376 
377  Clutch_struct * cs;
378  Chick_struct * pcs;
380  Covey_struct * covs;
381 
382  // Register the event with k_factors
384 
385  for ( int i = 0; i < number; i++ )
386  {
387  if ( ob_type == 0 ) // Clutch creation
388  {
389 
390  cs = dynamic_cast < Clutch_struct * > ( data );
391  New_Clutch = new Partridge_Clutch( cs->x, cs->y, cs->Mum, cs->m_covey, m_TheLandscape, cs->No,
392  cs->family_counter, this );
393  TheArray[ob_type].push_back( New_Clutch );
394  // Give mum the pointer to the clutch
395  m_comms_data->m_clutch = New_Clutch;
396  m_comms_data->m_female = cs->Mum;
398  // cs->Mum->OnSetMyClutch( New_Clutch );
399  // Register the event with k_factors
401 #ifdef __NESTPOSITIONS_OUT
403  if ((y>=cfg_ParNestPosOutStart.value()) &&(y<cfg_ParNestPosOutEnd.value())) {
404  int veg=int(m_TheLandscape->SupplyVegType(cs->x, cs->y));
405  int ele=int(m_TheLandscape->SupplyElementType(cs->x, cs->y));
406  fprintf(NestPositions,"%d\t%d\t%d\t%d\t%d\n",y,cs->x, cs->y,veg,ele);
407  }
408 #endif
409  }
410  if ( ob_type == 1 ) // Chick
411  {
412  pcs = dynamic_cast < Chick_struct * > ( data );
413  bool sex = false;
414  // if ( random( 2 ) == 1 ) sex = true; Sex ratio not 50:50
415  if ( random( 211 ) > 100 ) sex = true; // sex ratio 111/100 males/females Dammerham
416  New_Chick = new Partridge_Chick( pcs->x, pcs->y, pcs->Mum, pcs->m_covey, m_TheLandscape, sex,
417  pcs->family_counter, this );
418  // Add the new chick to the population managers arrays
419  TheArray[ob_type].push_back( New_Chick );
421  }
422  if ( ob_type == 2 ) // Chick2
423  {
424  pcs = dynamic_cast < Chick_struct * > ( data );
425  New_Chick2 = new Partridge_Chick2( pcs->x, pcs->y, pcs->Mum, pcs->m_covey, m_TheLandscape, pcs->sex,
426  pcs->family_counter, this );
427  // Add the new chick to the population managers arrays
428  TheArray[ob_type].push_back( New_Chick2 );
429  // Record the fact that we got this old
431  }
432  if ( ob_type == 3 ) // Male
433  {
434  as = dynamic_cast < AdultPartridge_struct * > ( data );
435  // Male
436  New_Male = new Partridge_Male( as->bx, as->by, as->x, as->y, as->m_covey, m_TheLandscape, as->family_counter, this );
437  TheArray[ob_type].push_back( New_Male );
438  }
439  if ( ob_type == 4 ) // Female
440  {
441  as = dynamic_cast < AdultPartridge_struct * > ( data );
442  // Female
443  New_Female = new Partridge_Female( as->bx, as->by, as->x, as->y, as->m_covey, m_TheLandscape, as->family_counter, this );
444  TheArray[ob_type].push_back( New_Female );
445  }
446  if ( ob_type == 5 ) // Covey
447  {
448  covs = dynamic_cast < Covey_struct * > ( data );
449  New_Flock = new Partridge_Covey( covs->first_member, this, covs->x, covs->y, m_TheLandscape );
450  TheArray[ob_type].push_back( New_Flock );
451  }
452  }
453 }
@ pob_Chick
Definition: Partridge_All.h:297
@ pcomm_SetClutch
Definition: Partridge_Communication.h:62
Struct to pass adult partridge information.
Definition: Partridge_All.h:386
Struct to pass chick information.
Definition: Partridge_All.h:374
bool sex
Definition: Partridge_All.h:377
Partridge_Female * Mum
Definition: Partridge_All.h:376
Struct to pass clutch information.
Definition: Partridge_All.h:362
Partridge_Female * Mum
Definition: Partridge_All.h:365
int No
Definition: Partridge_All.h:364
Struct to pass covey information.
Definition: Partridge_All.h:329
int y
Definition: Partridge_All.h:332
Partridge_Base * first_member
Definition: Partridge_All.h:333
int x
Definition: Partridge_All.h:331
TTypesOfVegetation SupplyVegType(int a_x, int a_y)
Definition: landscape.h:1321
The partridge Chick2 class.
Definition: Partridge_All.h:628
Partridge chick class.
Definition: Partridge_All.h:581
The partridge clutch class.
Definition: Partridge_All.h:518
bool PassMessage(PartridgeCommunicationData *pc_data, TypeOfPartridge_Communication pc)
Pass a message.
Definition: Partridge_Communication.cpp:86
Partridge_Communication m_messagecentre
Message class pointer.
Definition: Partridge_Population_Manager.h:163
Partridge_Covey * m_covey
Definition: Partridge_All.h:349
population_attributes * m_ThisYear
Definition: Partridge_All.h:251
void incNoClutchesHatched()
Definition: Partridge_All.h:96
void incNoChicksSixWeeks()
Definition: Partridge_All.h:112
void incNoClutches()
Definition: Partridge_All.h:87
void incNoChicksHatched()
Definition: Partridge_All.h:108
Partridge_Female * m_female
Definition: Partridge_Communication.h:84
Partridge_Clutch * m_clutch
Definition: Partridge_Communication.h:80

References Partridge_struct::bx, Partridge_struct::by, Partridge_struct::family_counter, Covey_struct::first_member, population_attributes::incNoChicksHatched(), population_attributes::incNoChicksSixWeeks(), population_attributes::incNoClutches(), population_attributes::incNoClutchesHatched(), PartridgeCommunicationData::m_clutch, m_comms_data, Partridge_struct::m_covey, PartridgeCommunicationData::m_female, m_messagecentre, m_Ourkfactors, Population_Manager::m_TheLandscape, k_factors::m_ThisYear, Clutch_struct::Mum, Chick_struct::Mum, Clutch_struct::No, Partridge_Communication::PassMessage(), pcomm_SetClutch, pob_Chick, random(), Chick_struct::sex, Landscape::SupplyElementType(), Landscape::SupplyVegType(), Landscape::SupplyYearNumber(), Population_Manager::TheArray, Covey_struct::x, Partridge_struct::x, Covey_struct::y, and Partridge_struct::y.

Referenced by Partridge_Chick::ChMaturing(), Partridge_Chick2::ChMaturing(), Partridge_Clutch::ClDeveloping(), and Partridge_Female::FMakingNest().

◆ DissolveCovey()

void Partridge_Population_Manager::DissolveCovey ( Partridge_Covey a_covey)


21/03/06 New information makes the males obtain visiting permission from another covey close to them. So that they are not alone. They can do this if the covey is not one formed from their parent covey. Movement from one covey to the next is not subject to alone mortality.

17/02/06 It seems that our behaviour here was not quite right. We need females to stay in the covey until found by a male.
So the sequence of events is:

1) Covery break up message received
2) Pairing in the covey where possible
3) Pairs leave and start repro
4) Single males leave and start to look for females
5) Females wait until a male comes along then they leave
6) When the last females dies or is paired this process is ended.

1476 {
1477 #ifdef __PAR_DEBUG2
1478  a_covey->SanityCheck();
1479  if ( !a_covey->AllFlocking2() )
1480  {
1481  m_TheLandscape->Warn( "Partridge_Pop_Man::DissolveCovey(): someone not flocking", "" );
1482  exit( 1 );
1483  }
1484  if ( !a_covey->ArePaired() )
1485  {
1486  m_TheLandscape->Warn( "Partridge_Pop_Man::DissolveCovey(): someone still paired", "" );
1487  exit( 1 );
1488  }
1489 #endif
1490  Partridge_Female * pf;
1491  Partridge_Male * pm;
1492  Partridge_Base * pb;
1493  int remaining = a_covey->GetCoveySize();
1494  do
1495  {
1496  // First loop through the females and see if they have old mates in the covey
1497  pf = a_covey->GetUnpairedFemale();
1498  if ( pf ) // There is a female and she has an oldmate in the covey
1499  {
1500  pm = pf->GetOldMate();
1501  // Take them both out of the covey
1502  remaining = a_covey->RemoveMember( pm );
1503  pm->SetUncleStatus( false );
1504  //remaining = a_covey->RemoveMember( pf );
1505  if (pf->GetUncleStatus()) {
1506  pf->SetUncleStatus( false );
1507  }
1508  // The Male must now make his own covey
1509  pm->MakeCovey(); // this will update his m_covey
1510  m_comms_data->m_female = pf;
1511  m_comms_data->m_male = pm;
1512  m_comms_data->m_covey = pm->GetCovey(); // synchronise coveys
1514  //remaining--; // The female gets removed from the covey by the above line
1515 #ifdef __PAR_DEBUG2
1516  if ( pm->GetObjectType() != pob_Male ) {
1517  m_TheLandscape->Warn( "Partridge_Pop_Man::DissolveCovey(): pm not male", "" );
1518  exit( 1 );
1519  }
1520  if ( pf->GetObjectType() != pob_Female ) {
1521  m_TheLandscape->Warn( "Partridge_Pop_Man::DissolveCovey(): pf not female", "" );
1522  exit( 1 );
1523  }
1524 
1525 #endif
1527  remaining = a_covey->GetCoveySize();
1528  }
1529  }
1530  while ( ( pf ) && ( remaining > 0 ) );
1531  // Send single males off
1532  pm=NULL;
1533  do {
1534  pm=a_covey->GetMaleInCovey();
1535  // The Male must now make his own covey
1536  if (pm!=NULL) {
1537  pm->MakeCovey(); // this will update his m_covey
1538  a_covey->RemoveMember(pm);
1539  remaining = a_covey->GetCoveySize();
1540  pm->StartBreedingBehaviour();
1541  }
1542  } while ( ( pm!=NULL ) && ( remaining > 0 ) && (a_covey->GetCurrentStateNo() > -1));
1543 
1544  if ( remaining > 0 )
1545  {
1546  // Should now only be females left
1547  pf = NULL;
1548  // At this point remaining has the remaining number of birds
1549  for ( int bird = 0; bird < remaining; bird++ )
1550  {
1551  pb = a_covey->GetMember( bird );
1552  pb->SetUncleStatus(false);
1553 #ifdef __PAR_DEBUG2
1554  if ( pb->GetObjectType() == pob_Male ) {
1555  m_TheLandscape->Warn( "Partridge_Pop_Man::DissolveCovey(): Male left in covey on dissolve", "" );
1556  exit( 1 );
1557  }
1558 #endif
1559  pf = dynamic_cast < Partridge_Female * > ( pb );
1560  m_comms_data->m_female = pf;
1561  m_messagecentre.PassMessage( m_comms_data, pcomm_WaitForMale ); // tells her to wait here for a male
1562  }
1563  }
1564 #ifdef __PAR_DEBUG2
1565  a_covey->SanityCheck();
1566 #endif
1567 }
@ pcomm_MatingM
Definition: Partridge_Communication.h:58
@ pcomm_WaitForMale
Definition: Partridge_Communication.h:64
@ pcomm_Mating
Definition: Partridge_Communication.h:57
void Warn(std::string a_msg1, std::string a_msg2)
Definition: landscape.h:1579
void MakeCovey()
Create our own covey.
Definition: Partridge_All.cpp:206
Partridge_Object GetObjectType()
Supply object type.
Definition: Partridge_All.h:432
Partridge_Covey * GetCovey(void)
Supply covey pointer.
Definition: Partridge_All.h:453
void SetUncleStatus(bool a_Status)
Set uncle status.
Definition: Partridge_All.h:442
bool GetUncleStatus()
Supply uncle status.
Definition: Partridge_All.h:437
unsigned int GetCoveySize()
Return the covey size.
Definition: Partridge_Covey.h:476
Partridge_Male * GetMaleInCovey()
Find a male in the covey.
Definition: Partridge_Covey.cpp:2323
Partridge_Female * GetUnpairedFemale()
Finds the first unpaired female in the covey.
Definition: Partridge_Covey.cpp:2304
Partridge_Base * GetMember(int a_member)
Returns pointer to a_member.
Definition: Partridge_Covey.cpp:1638
int RemoveMember(Partridge_Base *a_former_member)
Remove a member from the covey.
Definition: Partridge_Covey.cpp:1664
bool AllFlocking2()
Debug method.
Definition: Partridge_Covey.cpp:2373
void SanityCheck()
Debug method.
Definition: Partridge_Covey.cpp:2403
bool ArePaired()
Debug method.
Definition: Partridge_Covey.cpp:2384
Partridge_Male * GetOldMate(void)
Supply old mate pointer.
Definition: Partridge_All.h:893
void StartBreedingBehaviour(void)
Message handler.
Definition: Partridge_All.cpp:2719
int GetCurrentStateNo()
Returns the current state number.
Definition: PopulationManager.h:121
Partridge_Covey * m_covey
Definition: Partridge_Communication.h:85
Partridge_Male * m_male
Definition: Partridge_Communication.h:83

References Partridge_Covey::AllFlocking2(), Partridge_Covey::ArePaired(), Partridge_Base::GetCovey(), Partridge_Covey::GetCoveySize(), TALMaSSObject::GetCurrentStateNo(), Partridge_Covey::GetMaleInCovey(), Partridge_Covey::GetMember(), Partridge_Base::GetObjectType(), Partridge_Female::GetOldMate(), Partridge_Base::GetUncleStatus(), Partridge_Covey::GetUnpairedFemale(), m_comms_data, PartridgeCommunicationData::m_covey, PartridgeCommunicationData::m_female, PartridgeCommunicationData::m_male, m_messagecentre, Population_Manager::m_TheLandscape, Partridge_Base::MakeCovey(), Partridge_Communication::PassMessage(), pcomm_Mating, pcomm_MatingM, pcomm_WaitForMale, pob_Female, pob_Male, Partridge_Covey::RemoveMember(), Partridge_Covey::SanityCheck(), Partridge_Base::SetUncleStatus(), Partridge_Male::StartBreedingBehaviour(), and Landscape::Warn().

Referenced by Partridge_Covey::BeginStep().

◆ DoAfter()

void Partridge_Population_Manager::DoAfter ( )
privatevirtual

Utility method called before EndStep.

Reimplemented from Population_Manager.

1308 {
1309  int today = m_TheLandscape->SupplyDayInYear();
1310  // Shooting after cfg_ParShootStartYear years
1312  if ( today == September+4 )
1313  {
1314  // 5th September is shooting day
1316  pct+=cfg_ParShotMin.value();
1317  if (cfg_ParHuntingType.value()==1) HuntingGrid( pct );
1319  else Hunting( pct );
1320  }
1321  }
1322 }
static CfgInt cfg_ParShotMin("PAR_SHOTPERCENTAGE_MIN", CFG_CUSTOM, 1500)
Minimum% shot.
static CfgInt cfg_ParShotMax("PAR_SHOTPERCENTAGE_MAX", CFG_CUSTOM, 1500)
Maximum% shot.
static CfgInt cfg_ParHuntingType("PAR_HUNTINGTYPE", CFG_CUSTOM, 1)
0 if global hunting, else threshold
static CfgInt cfg_ParShootStartYear("PAR_SHOOTSTARTYEAR", CFG_CUSTOM, 1)
First year with hunting.
void Hunting(int p_chance)
Global hunting.
Definition: Partridge_Population_Manager.cpp:1116
void HuntingGrid(int p_chance)
Density grid-based hunting.
Definition: Partridge_Population_Manager.cpp:1159
void HuntingDifferentiatedBeetleBankArea(int a_pct)
Differentiated hunting in beetlebank areas.
Definition: Partridge_Population_Manager.cpp:1204
const int September
Definition: landscape.h:44

References cfg_ParHuntingType, cfg_ParShootStartYear, cfg_ParShotMax, cfg_ParShotMin, Hunting(), HuntingDifferentiatedBeetleBankArea(), HuntingGrid(), Population_Manager::m_TheLandscape, random(), September, Landscape::SupplyDayInYear(), Landscape::SupplyYearNumber(), and CfgInt::value().

◆ DoAlmostLast()

void Partridge_Population_Manager::DoAlmostLast ( void  )
privatevirtual

Utility method called after EndStep.

Reimplemented from Population_Manager.

1336 {
1338  {
1339  // Calculate and write output to flock data file
1340  int si = (int) TheArray[pob_Covey].size();
1341  int size, chi;
1342  for ( int i = 0; i < si; i++ )
1343  {
1344  // Generate a date to dissolve
1345  size = dynamic_cast < Partridge_Covey * > ( TheArray[pob_Covey] [i] )->GetCoveySize();
1346  chi = dynamic_cast < Partridge_Covey * > ( TheArray[pob_Covey] [i] )->GetOurChicks();
1348  }
1349  }
1350  // Unpaired Males
1352  {
1353  // Calculate and write output to flock data file
1354  int si = (int) TheArray[pob_Male].size();
1355  int upm = 0;
1356  for ( int i = 0; i < si; i++ )
1357  {
1358  // Generate a date to dissolve
1359  if ( !dynamic_cast < Partridge_Male * > ( TheArray[pob_Male] [i] )->GetMate() ) upm++;
1360  }
1362  }
1363  // No Breeding Pairs
1365  {
1366  // Calculate and write output to flock data file
1367  int si = (int) TheArray[pob_Female].size();
1368  int nobs = 0;
1369  for ( int i = 0; i < si; i++ )
1370  {
1371  // Generate a date to dissolve
1372  if ( dynamic_cast < Partridge_Female * > ( TheArray[pob_Female] [i] )->GetMate() ) nobs++;
1373  }
1375  }
1376  if ( m_TheLandscape->SupplyDayInYear() == 364 )
1377  {
1379  m_HatchSuccess = 0;
1380  }
1381 }
@ pob_Covey
Definition: Partridge_All.h:297
static CfgInt cfg_unpaireddata_date("PAR_UNPAIREDDATA_DATE", CFG_CUSTOM, 150)
Probe date.
static CfgInt cfg_breedingpairs_date("PAR_BREEDINGPAIRS_DATE", CFG_CUSTOM, 90)
Probe date.
static CfgInt cfg_flockdata_date("PAR_FLOCKDATA_DATE", CFG_CUSTOM, 270)
Date when birds start to flock.
long SupplyGlobalDate(void)
Definition: landscape.h:1621
Partridge_Male * GetMate(void)
Supply mate pointer.
Definition: Partridge_All.h:872
Partridge_Female * GetMate(void)
Are we paired?
Definition: Partridge_All.h:719
void WriteParNoB(int a_min, int a_nob)
Output method.
Definition: Partridge_Population_Manager.cpp:1670
void WriteNoHatchedPerYear(int a_min, int a_num)
Output method.
Definition: Partridge_Population_Manager.cpp:1696
void WriteParFlocks(int a_min, int a_size, int a_young)
Output method.
Definition: Partridge_Population_Manager.cpp:1688
void WriteParUnpairedMale(int a_min, int a_num)
Output method.
Definition: Partridge_Population_Manager.cpp:1676

References cfg_breedingpairs_date, cfg_flockdata_date, cfg_unpaireddata_date, Partridge_Male::GetMate(), Partridge_Female::GetMate(), m_HatchSuccess, Population_Manager::m_TheLandscape, pob_Covey, pob_Female, pob_Male, Landscape::SupplyDayInYear(), Landscape::SupplyGlobalDate(), Population_Manager::TheArray, CfgInt::value(), WriteNoHatchedPerYear(), WriteParFlocks(), WriteParNoB(), and WriteParUnpairedMale().

◆ DoBefore()

void Partridge_Population_Manager::DoBefore ( void  )
privatevirtual

Utility method called before Step.

Reimplemented from Population_Manager.

1298 {
1299 #ifdef __PARDEBUG4
1300  DoSanityCheck();
1301 #endif
1302 }
void DoSanityCheck()
Debug only.
Definition: Partridge_Population_Manager.cpp:1252

References DoSanityCheck().

◆ DoFirst()

void Partridge_Population_Manager::DoFirst ( void  )
privatevirtual

Utility method called before BeginStep.

One of the primary methods where output and control activities can occur. Since this is the first method called before BeginStep there are no internal inconsistencies and it is certain that all extant objects will be counted/informed.

Reimplemented from Population_Manager.

591 {
592  /* if (g_date->Date()<730) { m_female_mortality_alone=0; if (g_date->Date()==729) {
593  m_female_mortality_alone=cfg_par_female_mortality_alone.value(); } } */
594  int today = m_TheLandscape->SupplyDayInYear();
595 
596  if (today==March+22) {
597  if (m_TheLandscape->SupplyYearNumber()>5) {
598  Partridge_Male* PM = NULL; // assignment to get rid of warning
599  Partridge_Female* PF = NULL;
600  if ((int)TheArray[pob_Female].size() > cfg_FemalePopSizeMaxCutoff.value() ){
601  unsigned size2 = (unsigned) TheArray[ pob_Male ].size();
602  for ( unsigned j = 0; j < size2; j++ ) {
603  PM = dynamic_cast < Partridge_Male * > ( TheArray[ pob_Male ] [ j ] );
604  PM->KillThis();
605  }
606  size2 = (unsigned) TheArray[ pob_Female ].size();
607  for ( unsigned j = 0; j < size2; j++ ) {
608  PF = dynamic_cast < Partridge_Female * > ( TheArray[ pob_Female ] [ j ] );
609  PF->KillThis();
610  }
611  }
612  }
613  }
614 
615  // Need to UpdateNestingCoverMap every so often in the breeding season
616  if ( ( today >= cfg_par_start_dissolve.value() ) && ( today < cfg_par_male_gives_up.value() ) && (TheArray[ pob_Female ].size()>0))
617  {
618  int daysfromstart=today-cfg_par_start_dissolve.value();
619  // for now do it every 7 days
620  if ( daysfromstart % 7 == 0 ) UpdateNestingCoverMap();
621  }
622  if ( today == (cfg_springcensusdate.value()-1) )
623  {
624  /*
625  // Before we do anything we may need to have emigration
626  if (cfg_Emigration.value() >0) {
627  unsigned int sz = (int)TheArray[pob_Covey].size();
628  int testvalue;
629  if (sz>1) testvalue=cfg_Emigration.value(); else testvalue=cfg_IndividualEmigration.value();
630  for (unsigned int c=0; c<sz; c++) {
631  if (random(10000) < testvalue) {
632  dynamic_cast < Partridge_Covey * > ( TheArray[pob_Covey] [c] )->CoveyEmigrate();
633  }
634  }
635  }
636  */
637  // Testing 15/04/08
638  // Before we do anything we may need to have emigration
639  if (cfg_Emigration.value() >0) {
640  unsigned int sz = (int)TheArray[pob_Covey].size();
641  int testvalue=cfg_Emigration.value();
642  for (unsigned int c=0; c<sz; c++) {
643  if (random(10000) < testvalue) {
644  dynamic_cast < Partridge_Covey * > ( TheArray[pob_Covey] [c] )->CoveyEmigrate();
645  }
646  else {
647  dynamic_cast < Partridge_Covey * > (TheArray[pob_Covey][c])->CoveyIndividualEmigrate();
648  }
649  }
650  }
651  }
652  if ( today == cfg_springcensusdate.value() )
653  {
654  // before 1st clutch is possible 80
655  int birds = (int)TheArray[pob_Male].size() + (int)TheArray[pob_Female].size();
656  // No Breeding Pairs
657  // Calculate and write output to flock data file
658  int si = (int)TheArray[pob_Female].size();
659  int nobs = 0;
660  int nts = 0;
661  for ( int i = 0; i < si; i++ )
662  {
663  // Generate a date to dissolve
664  if ( dynamic_cast < Partridge_Female * > ( TheArray[pob_Female] [i] )->GetMate() ) nobs++;
665  if ( dynamic_cast < Partridge_Female * > ( TheArray[pob_Female] [i] )->HaveTerritory() ) nts++;
666  }
670  si = (int) TheArray[pob_Male].size();
675  }
676 
677  // Added by Krishnan Sudharsan on May 15, 2007
678  // Needed to count territorial/non-territorial females in May
679  if ( today == May+15 )
680  { int num = (int)TheArray[pob_Female].size();
681  int nobs = 0;
682  int difference = 0;
683  for ( int i = 0; i < num; i++ )
684  {
685  // Find the number of territorial females on May 15th
686  if ( dynamic_cast < Partridge_Female * > ( TheArray[pob_Female] [i] )->HaveTerritory() ) nobs++;
687  }
688  difference = num - nobs;
691  }
692 
693  if ( today == August+4 )
694  { // Aug 5th
699  }
700 
701  if ( today == September )
702  { // 1st Sept
703  // add 50% of chicks to males and females - assumes a 1:1 ratio at hatch
704  int nochicks = (int) TheArray[pob_Chick].size();
705  nochicks += (int) TheArray[pob_Chick2].size();
706  m_Ourkfactors->m_ThisYear->setNoFemalesSept( ( nochicks / 2 ) + (int) TheArray[pob_Female].size() );
707  m_Ourkfactors->m_ThisYear->setNoMalesSept( ( nochicks / 2 ) + (int) TheArray[pob_Male].size() );
708  // Need to set old birds values too
709  Partridge_Base * pf;
710  unsigned sz = (unsigned) TheArray[pob_Female].size();
711  int oldbirds = 0;
712  for ( unsigned j = 0; j < sz; j++ )
713  {
714  pf = dynamic_cast < Partridge_Base * > ( TheArray[pob_Female] [j] );
715  if ( pf->GetAge() > 244 ) oldbirds++;
716  }
717  nochicks += ( sz - oldbirds );
719  oldbirds = 0;
720  sz = (unsigned) TheArray[pob_Male].size();
721  for ( unsigned j = 0; j < sz; j++ )
722  {
723  pf = dynamic_cast < Partridge_Base * > ( TheArray[pob_Male] [j] );
724  if ( pf->GetAge() > 244 ) oldbirds++;
725  }
726  m_Ourkfactors->m_ThisYear->setNoOldMales( oldbirds );
727  nochicks += ( sz - oldbirds );
730  // Here we have a problem that not all chicks have reached 6 weeks - so add
731  // the little ones now
733  // Do those calculations we can now
735  }
736  else if ( today == November )
737  { // after shoot is what is important
740  }
741  else if ( today == December+14 ) {
742  // Mid December counts of males and females
745  }
747  //DoSanityCheck();
748  //MaleImmigration(); // unused at present
749  TestShouldFlock();
750 }
@ pob_Chick2
Definition: Partridge_All.h:297
class CoveyManager * g_covey_manager
Definition: Partridge_Covey.cpp:2070
static CfgInt cfg_FemalePopSizeMaxCutoff("PAR_FEMMAXPOPSIZECUTOFF", CFG_CUSTOM, 7000)
Point at which the simulation is terminated due to excessive population size.
CfgInt cfg_par_male_gives_up
static CfgInt cfg_Emigration("PAR_EMIGRATION", CFG_CUSTOM, 1)
Loss due to emmigration (out of 10000)
CfgInt cfg_par_start_dissolve
Definition: Partridge_Population_Manager.cpp:94
static CfgInt cfg_springcensusdate("PAR_SPRINGCENSUSDATE", CFG_CUSTOM, March+21)
Probe date.
double BroodGeoMean()
Calculate the geometric mean of no of chicks.
Definition: Partridge_Covey.cpp:2117
void Tick(void)
Do the covey management for the time-step.
Definition: Partridge_Covey.cpp:2144
int GetAge(void)
Supply age.
Definition: Partridge_All.h:472
bool HaveTerritory(void)
Have we a breeding 'territory'?
Definition: Partridge_All.h:920
virtual void KillThis()
Direct mortality message.
Definition: Partridge_All.h:888
virtual void KillThis()
General direct mortality handler.
Definition: Partridge_All.h:703
void UpdateNestingCoverMap()
Definition: Partridge_Population_Manager.cpp:1084
void TestShouldFlock()
Should the birds start to flock?
Definition: Partridge_Population_Manager.cpp:1435
void calcreal_3()
Definition: Partridge_All.cpp:3015
void Output_kfactors()
Definition: Partridge_All.cpp:2893
void calcreal_2()
Definition: Partridge_All.cpp:3006
void calcDickPottsk()
Definition: Partridge_All.cpp:3026
void calcreal_1()
Definition: Partridge_All.cpp:2994
void setNoMalesAug(int nm)
Definition: Partridge_All.h:220
void setNoMalesSept(int n)
Definition: Partridge_All.h:148
void SetTerritorialFemalesInApril(double fa)
Definition: Partridge_All.h:128
void SetBroodGeoMean(double gm)
Definition: Partridge_All.h:136
void setNoFemsAug(int nf)
Definition: Partridge_All.h:224
void setNoChick2sAug(int ch)
Definition: Partridge_All.h:216
void SetMalesInApril(double fa)
Definition: Partridge_All.h:124
void SetFemalesInApril(double fa)
Definition: Partridge_All.h:120
void setNoChicksSept(int n)
Definition: Partridge_All.h:140
void setNoFemalesDec(int n)
Definition: Partridge_All.h:152
void SetPairsInApril(double pa)
Definition: Partridge_All.h:116
void SetBirdsInApril(double ba)
Definition: Partridge_All.h:132
void setNoOldMales(int nm)
Definition: Partridge_All.h:192
void setNoFemalesSept(int n)
Definition: Partridge_All.h:144
void SetTerritorialFemalesInMay(int nf)
Definition: Partridge_All.h:200
void setNoOldFemales(int nf)
Definition: Partridge_All.h:196
void SetNonTerritorialFemalesInMay(int nf)
Definition: Partridge_All.h:204
void AddToChicks6wks(int ch)
Definition: Partridge_All.h:208
void setNoMalesDec(int n)
Definition: Partridge_All.h:156
void setNoChick1sAug(int ch)
Definition: Partridge_All.h:212
const int November
Definition: landscape.h:46
const int March
Definition: landscape.h:38
const int May
Definition: landscape.h:40
const int August
Definition: landscape.h:43
const int December
Definition: landscape.h:47

References population_attributes::AddToChicks6wks(), August, CoveyManager::BroodGeoMean(), k_factors::calcDickPottsk(), k_factors::calcreal_1(), k_factors::calcreal_2(), k_factors::calcreal_3(), cfg_Emigration, cfg_FemalePopSizeMaxCutoff, cfg_par_male_gives_up, cfg_par_start_dissolve, cfg_springcensusdate, December, g_covey_manager, Partridge_Base::GetAge(), Partridge_Female::GetMate(), Partridge_Female::HaveTerritory(), Partridge_Male::KillThis(), Partridge_Female::KillThis(), m_Ourkfactors, Population_Manager::m_TheLandscape, k_factors::m_ThisYear, March, May, November, k_factors::Output_kfactors(), pob_Chick, pob_Chick2, pob_Covey, pob_Female, pob_Male, random(), September, population_attributes::SetBirdsInApril(), population_attributes::SetBroodGeoMean(), population_attributes::SetFemalesInApril(), population_attributes::SetMalesInApril(), population_attributes::setNoChick1sAug(), population_attributes::setNoChick2sAug(), population_attributes::setNoChicksSept(), population_attributes::setNoFemalesDec(), population_attributes::setNoFemalesSept(), population_attributes::setNoFemsAug(), population_attributes::setNoMalesAug(), population_attributes::setNoMalesDec(), population_attributes::setNoMalesSept(), population_attributes::SetNonTerritorialFemalesInMay(), population_attributes::setNoOldFemales(), population_attributes::setNoOldMales(), population_attributes::SetPairsInApril(), population_attributes::SetTerritorialFemalesInApril(), population_attributes::SetTerritorialFemalesInMay(), Landscape::SupplyDayInYear(), Landscape::SupplyYearNumber(), TestShouldFlock(), Population_Manager::TheArray, CoveyManager::Tick(), UpdateNestingCoverMap(), and CfgInt::value().

◆ DoLast()

void Partridge_Population_Manager::DoLast ( void  )
privatevirtual

Ultility method called at the end of the time-step.

Reimplemented from Population_Manager.

1327 {
1329 #ifdef __PARDEBUG4
1330  DoSanityCheck();
1331 #endif
1332 }
virtual void DoLast()
Definition: PopulationManager.cpp:530

References Population_Manager::DoLast(), and DoSanityCheck().

◆ DoMaleSanityCheck()

void Partridge_Population_Manager::DoMaleSanityCheck ( )

Debug only.

A debug function.

1275 {
1276  // THIS IS A DEBUG FUNCTION
1277  int counter = 0;
1278  for ( unsigned j = 0; j < TheArray[pob_Male].size(); j++ )
1279  {
1280  Partridge_Male * pm = dynamic_cast < Partridge_Male * > ( TheArray[pob_Male] [j] );
1281  if ( pm->WhatState() != pars_Destroy )
1282  {
1283  int res = pm->AmIaMember();
1284  if ( res == 1 ) bad_guys[counter++] = pm;
1285  if ( res == 2 )
1286  {
1287  m_TheLandscape->Warn( "Partridge_Pop_Man::DoMaleSanityCheck(): ""Someone is not a member of their covey", "" );
1288  exit( 0 );
1289  }
1290  }
1291  }
1292 }
@ pars_Destroy
Definition: Partridge_All.h:287
int AmIaMember()
A debug function.
Definition: Partridge_All.cpp:3159
Partridge_Male * bad_guys[500]
Debug.
Definition: Partridge_Population_Manager.h:159
virtual int WhatState()
Definition: PopulationManager.h:263

References Partridge_Male::AmIaMember(), bad_guys, Population_Manager::m_TheLandscape, pars_Destroy, pob_Male, Population_Manager::TheArray, Landscape::Warn(), and TAnimal::WhatState().

◆ DoSanityCheck()

void Partridge_Population_Manager::DoSanityCheck ( )

Debug only.

A debug function.

1253 {
1254  int today = m_TheLandscape->SupplyDayInYear();
1255  //if ( today == 60 )
1256  {
1257  for ( unsigned j = 0; j < TheArray[pob_Covey].size(); j++ )
1258  {
1259  dynamic_cast < Partridge_Covey * > ( TheArray[pob_Covey] [j] )->SanityCheck();
1260  }
1261  }
1262  if (( today < 61 ) || (today>270))
1263  {
1264  for ( unsigned j = 0; j < TheArray[pob_Covey].size(); j++ )
1265  {
1266  dynamic_cast < Partridge_Covey * > ( TheArray[pob_Covey] [j] )->SanityCheck4();
1267  }
1268  }
1269 }

References Population_Manager::m_TheLandscape, pob_Covey, Landscape::SupplyDayInYear(), and Population_Manager::TheArray.

Referenced by DoBefore(), and DoLast().

◆ EvalHabitatQual()

double Partridge_Population_Manager::EvalHabitatQual ( TTypesOfLandscapeElement  a_cet,
int  a_poly 
)
private

Part of habitat quality map evaluation.

838 {
839  int st;
840  switch ( a_cet )
841  {
842 
843  // Terrible stuff
844  case tole_IndividualTree:
845  case tole_WindTurbine:
847  case tole_WoodlandMargin:
848  case tole_Pylon:
850  case tole_MixedForest:
852  case tole_Building:
853  case tole_UrbanNoVeg:
854  return -2.0;
855 
856  // Bad stuff.
857  case tole_MetalledPath:
858  case tole_Carpark:
859  case tole_Churchyard:
860  case tole_Saltmarsh:
861  case tole_Stream:
862  case tole_HeritageSite:
864  case tole_RiversideTrees:
865  case tole_Garden:
866  case tole_Track:
867  case tole_SmallRoad:
868  case tole_LargeRoad:
869  case tole_ActivePit:
870  case tole_Pond:
871  case tole_Freshwater:
872  case tole_River:
873  case tole_Saltwater:
874  case tole_Coast:
875  case tole_BareRock:
876  case tole_AmenityGrass:
877  case tole_Parkland:
878  case tole_UrbanPark:
880  case tole_SandDune:
881  case tole_Copse:
882  case tole_PlantNursery:
883  return -1.0;
884 
885  // Questionable.
886  case tole_StoneWall:
887  case tole_Fence:
888  case tole_Hedges:
889  case tole_Marsh:
890  case tole_PitDisused:
891  return 0.0;
892 
893  // OK stuff
895  case tole_RoadsideSlope:
896  case tole_PermPasture:
898  return 2.0;
899 
901  case tole_RoadsideVerge:
902  case tole_Railway:
903  case tole_FieldBoundary:
906  case tole_YoungForest: // ?
907  case tole_Heath:
908  case tole_Orchard:
909  case tole_OrchardBand:
910  case tole_MownGrass:
911  case tole_Scrub:
912  case tole_Vildtager:
913  return 4.0;
914 
915  // Really good stuff!
916  case tole_BeetleBank:
917  return cfg_nest_hedgebank1.value();
918  case tole_HedgeBank:
919  st = m_TheLandscape->SupplyElementSubType( a_poly );
920  switch ( st )
921  {
922  case 0:
923  return cfg_nest_hedgebank0.value();
924  case 1:
925  return cfg_nest_hedgebank1.value();
926  case 2:
927  return cfg_nest_hedgebank2.value();
928  default:
929  return 100;
930  }
931  // Variable, depending on vegetation and condition of same.
932  case tole_Field:
934  return HabitatEvalPolyField( a_poly );
935 
936  default:
937  g_msg->Warn( WARN_BUG, "Partridge_Population_Manager::EvalTerrQual: Unknown Element type", "" );
938  exit( 10 );
939  }
940 }
CfgInt cfg_nest_hedgebank1
CfgInt cfg_nest_hedgebank0
CfgInt cfg_nest_hedgebank2
int HabitatEvalPolyField(int a_field)
Part of habitat quality map evaluation.
Definition: Partridge_Population_Manager.cpp:943
@ WARN_BUG
Definition: maperrormsg.h:34
@ tole_PermPastureTussocky
Definition: tole_declaration.h:45
@ tole_WoodyEnergyCrop
Definition: tole_declaration.h:94
@ tole_MixedForest
Definition: tole_declaration.h:53
@ tole_WoodlandMargin
Definition: tole_declaration.h:98
@ tole_RoadsideSlope
Definition: tole_declaration.h:83
@ tole_NaturalGrassWet
Definition: tole_declaration.h:87
@ tole_NaturalGrassDry
Definition: tole_declaration.h:48
@ tole_Pylon
Definition: tole_declaration.h:96
@ tole_PermanentSetaside
Definition: tole_declaration.h:46
@ tole_Scrub
Definition: tole_declaration.h:42
@ tole_Field
Definition: tole_declaration.h:43
@ tole_PermPasture
Definition: tole_declaration.h:47
@ tole_Hedges
Definition: tole_declaration.h:37
@ tole_Track
Definition: tole_declaration.h:59
@ tole_Heath
Definition: tole_declaration.h:70
@ tole_PitDisused
Definition: tole_declaration.h:50
@ tole_FieldBoundary
Definition: tole_declaration.h:40
@ tole_PlantNursery
Definition: tole_declaration.h:95
@ tole_DeciduousForest
Definition: tole_declaration.h:52
@ tole_ActivePit
Definition: tole_declaration.h:63
@ tole_RiversidePlants
Definition: tole_declaration.h:49
@ tole_RoadsideVerge
Definition: tole_declaration.h:38
@ tole_Vildtager
Definition: tole_declaration.h:99
@ tole_Orchard
Definition: tole_declaration.h:71
@ tole_MownGrass
Definition: tole_declaration.h:74
@ tole_YoungForest
Definition: tole_declaration.h:55
@ tole_OrchardBand
Definition: tole_declaration.h:73
@ tole_SmallRoad
Definition: tole_declaration.h:60
@ tole_PermPastureLowYield
Definition: tole_declaration.h:44
@ tole_Railway
Definition: tole_declaration.h:39
@ tole_WindTurbine
Definition: tole_declaration.h:97
@ tole_ConiferousForest
Definition: tole_declaration.h:54
@ tole_IndividualTree
Definition: tole_declaration.h:93
@ tole_RiversideTrees
Definition: tole_declaration.h:51
@ tole_LargeRoad
Definition: tole_declaration.h:61
@ tole_UnsprayedFieldMargin
Definition: tole_declaration.h:72
@ tole_BeetleBank
Definition: tole_declaration.h:69
@ tole_Marsh
Definition: tole_declaration.h:41

References cfg_nest_hedgebank0, cfg_nest_hedgebank1, cfg_nest_hedgebank2, g_msg, HabitatEvalPolyField(), Population_Manager::m_TheLandscape, Landscape::SupplyElementSubType(), tole_ActivePit, tole_AmenityGrass, tole_BareRock, tole_BeetleBank, tole_Building, tole_BuiltUpWithParkland, tole_Carpark, tole_Churchyard, tole_Coast, tole_ConiferousForest, tole_Copse, tole_DeciduousForest, tole_Fence, tole_Field, tole_FieldBoundary, tole_Freshwater, tole_Garden, tole_Heath, tole_HedgeBank, tole_Hedges, tole_HeritageSite, tole_IndividualTree, tole_LargeRoad, tole_Marsh, tole_MetalledPath, tole_MixedForest, tole_MownGrass, tole_NaturalGrassDry, tole_NaturalGrassWet, tole_Orchard, tole_OrchardBand, tole_Parkland, tole_PermanentSetaside, tole_PermPasture, tole_PermPastureLowYield, tole_PermPastureTussocky, tole_PitDisused, tole_PlantNursery, tole_Pond, tole_Pylon, tole_Railway, tole_River, tole_RiversidePlants, tole_RiversideTrees, tole_RoadsideSlope, tole_RoadsideVerge, tole_Saltmarsh, tole_Saltwater, tole_SandDune, tole_Scrub, tole_SmallRoad, tole_StoneWall, tole_Stream, tole_Track, tole_UnsprayedFieldMargin, tole_UrbanNoVeg, tole_UrbanPark, tole_Vildtager, tole_WindTurbine, tole_WoodlandMargin, tole_WoodyEnergyCrop, tole_YoungForest, CfgInt::value(), MapErrorMsg::Warn(), and WARN_BUG.

Referenced by CreateNestingCoverDensityMap(), and UpdateNestingCoverMap().

◆ FillCoveyNeigbourList()

bool Partridge_Population_Manager::FillCoveyNeigbourList ( Partridge_Covey a_covey,
int  a_distance,
int  a_x,
int  a_y 
)

Get a list of neighbour covies.

1572 {
1573  // This list loops through the coveys and checks whether they are within
1574  // a_distance. If so add them to the covey neighbour list
1575  //
1576  // Start by emptying the covey neighbour list
1577  a_covey->m_neighbourlist_size = 0;
1578  // Now loop
1579  int size2 = (int) TheArray[pob_Covey].size();
1580  for ( int j = 0; j < size2; j++ )
1581  {
1582  int x = TheArray[pob_Covey] [j]->Supply_m_Location_x();
1583  int y = TheArray[pob_Covey] [j]->Supply_m_Location_y();
1584  int dx = abs( x - a_x );
1585  int dy = abs( y - a_y );
1586  // OK OK, this is not the real distance, but it is a reasonable approximation (max x0.3 out)
1587  int dist = dx + dy;
1588  // There are only 25 spaces in the neighbour list so don't risk an overflow
1589  if ( ( a_covey->m_neighbourlist_size < 25 ) && ( dist <= a_distance ) &&
1590  ( TheArray[pob_Covey] [j] != a_covey ) && ( TheArray[pob_Covey] [j]->GetCurrentStateNo() != -1) )
1591  {
1592  Partridge_Covey * cov = dynamic_cast < Partridge_Covey * > ( TheArray[pob_Covey] [j] );
1593  a_covey->m_neighbourlist[a_covey->m_neighbourlist_size++] = cov;
1594  }
1595  }
1596  if ( a_covey->m_neighbourlist_size == 0 ) return false;
1597  return true;
1598 }
Partridge_Covey * m_neighbourlist[50]
List of coveys close to this covey.
Definition: Partridge_Covey.h:284
int m_neighbourlist_size
Number of coveys close to this covey.
Definition: Partridge_Covey.h:286

References Partridge_Covey::m_neighbourlist, Partridge_Covey::m_neighbourlist_size, pob_Covey, and Population_Manager::TheArray.

Referenced by Partridge_Male::MFindingMate().

◆ FillInFoodArray()

void Partridge_Population_Manager::FillInFoodArray ( )
private

Precalculated food values with age.

Rather than calculate it every time we need it, this method fills in the values required for each age in days.
The rain scaling factor decreases the energy needed if there is no rain which is compensated for by increased demands when there is rain - overall we maintain our fit to Damerham data.

1391 {
1392  double mult;
1393  for ( int i = 0; i < 200; i++ )
1394  {
1395  // using the raw data will provide the result in Kcal per day
1396  // These then need to be scaled to the expectation of extraction
1397  // by multiplication by the extraction rate
1399  else
1400  mult = i;
1401  // SetFoodNeed(i,(double) cfg_par_energyslope_perday.value()*mult);
1402 #ifdef __RAIN_HURTS
1403  // NB 0.8 is just a guess - we would need a special study on this to firm up this factor
1404  g_FoodNeed[i] = ( double )cfg_par_energyslope_perday.value() * mult * cfg_rainscaling.value();
1405 #else
1406  g_FoodNeed[i] = ( double )cfg_par_energyslope_perday.value() * mult;
1407 #endif
1408  }
1409  int half_grown = cfg_par_mature_threshold.value() / 2;
1410  for ( int i = 0; i < 200; i++ )
1411  {
1412  if ( i > half_grown ) mult = half_grown;
1413  else
1414  mult = i;
1415  g_MaxWalk[i] = ( int )( 50 + ( ( ( 500 - 50 ) / half_grown ) * mult ) );
1416  }
1417 }
double g_FoodNeed[200]
Definition: Partridge_Population_Manager.cpp:65
static CfgFloat cfg_par_energyslope_perday("PAR_ENERGYSLOPE_PERDAY", CFG_CUSTOM, 1.06)
Slope of linear increase in energy needs of chicks.
CfgInt cfg_par_mature_threshold
int g_MaxWalk[200]
Definition: Partridge_Population_Manager.cpp:66
static CfgFloat cfg_rainscaling("PAR_RAINSCALING", CFG_CUSTOM, 0.767)
Correction for using rainfall penalty.
double value(void)
Definition: configurator.h:118

References cfg_par_energyslope_perday, cfg_par_mature_threshold, cfg_rainscaling, g_FoodNeed, g_MaxWalk, CfgInt::value(), and CfgFloat::value().

Referenced by Init().

◆ GetHabitatQuality()

double Partridge_Population_Manager::GetHabitatQuality ( int  a_day)
inline


304 {return m_HabitatQuality[a_day];}
double m_HabitatQuality[300]
Part of habitat quality map evaluation.
Definition: Partridge_Population_Manager.h:151

References m_HabitatQuality.

Referenced by Partridge_Female::FFindingTerritory().

◆ GetNestingCoverDensity()

double Partridge_Population_Manager::GetNestingCoverDensity ( int  x,
int  y 
)


755 {
756 /*
757  x /= 10;
758  y /= 10;
759  return m_nestingcovermap->qualmap[x] [y];
760 */
761  return m_nestingcovermap->GetQual(a_x,a_y);
762 }
double GetQual(int a_x, int a_y)
Definition: Partridge_Population_Manager.h:75

References CoverTempMap::GetQual(), and m_nestingcovermap.

Referenced by Partridge_Female::GetNestingCoverDensity().

◆ GetNewID()

unsigned int Partridge_Population_Manager::GetNewID ( )
inline


281  {
282  return ++m_Partridge_IDs;
283  }
unsigned int m_Partridge_IDs
Definition: Partridge_Population_Manager.h:116

References m_Partridge_IDs.

◆ GetTerrQual()

double Partridge_Population_Manager::GetTerrQual ( int  x,
int  y 
)


767 {
768 /*
769  x /= 10;
770  y /= 10;
771  return m_territoryqualmap->qualmap[x] [y];
772 */
773  return m_territoryqualmap->GetQual(a_x,a_y);
774 }

References CoverTempMap::GetQual(), and m_territoryqualmap.

◆ HabitatEvalPolyField()

int Partridge_Population_Manager::HabitatEvalPolyField ( int  a_field)
private

Part of habitat quality map evaluation.

944 {
945 
946  TTypesOfVegetation l_tov = m_TheLandscape->SupplyVegType( a_field );
947  int score = 0;
948  switch ( l_tov )
949  {
951  case tov_OGrazingPigs:
955  score = 0;
956  break;
957 
958  case tov_Carrots:
959  case tov_FieldPeas:
960  case tov_FodderBeet:
961  case tov_SugarBeet:
962  case tov_OFodderBeet:
963  case tov_Maize:
964  case tov_NoGrowth:
965  case tov_None:
966  case tov_OPotatoes:
967  case tov_WinterRape:
968  case tov_Potatoes:
970  score = 1;
971  break;
972 
975  case tov_FodderGrass:
978  case tov_Oats:
979  case tov_OOats:
980  case tov_OSeedGrass1:
981  case tov_OSeedGrass2:
982  case tov_OSpringBarley:
987  case tov_OTriticale:
988  case tov_OWinterBarley:
990  case tov_OWinterRape:
991  case tov_OWinterRye:
993  case tov_OWinterWheat:
994  case tov_SeedGrass1:
995  case tov_SeedGrass2:
996  case tov_SpringBarley:
997  case tov_SpringBarleySpr:
1001  case tov_SpringBarleyGrass:
1002  case tov_SpringBarleySeed:
1004  case tov_SpringRape:
1005  case tov_SpringWheat:
1006  case tov_Triticale:
1007  case tov_WinterBarley:
1008  case tov_WinterRye:
1009  case tov_WinterWheat:
1010  case tov_WWheatPControl:
1012  case tov_WWheatPTreatment:
1014  case tov_WinterWheatShort:
1018  case tov_OSBarleySilage:
1019  case tov_OCarrots:
1021  case tov_OFieldPeas:
1022  case tov_OFieldPeasSilage:
1023  case tov_YoungForest:
1024  case tov_Heath:
1025  case tov_BroadBeans:
1026  score = 2;
1027  if (m_TheLandscape->SupplyVegPatchy(a_field)) score+=2;
1028  //if (m_TheLandscape->SupplyHasTramlines(a_field)) score+=1;
1029  break;
1030 
1031  /* case tov_OGrassClover1: case tov_OGrassClover2: case tov_OBarleyPeaCloverGrass: case tov_OCarrots:
1032  case tov_OCloverGrassGrazed1: case tov_OCloverGrassGrazed2: case tov_OCloverGrassSilage1: case tov_OFieldPeas:
1033  case tov_OPermanentGrassGrazed: case tov_PermanentGrassGrazed: case tov_PermanentGrassTussocky: return 3.0; */
1034 
1035  case tov_Setaside:
1036  case tov_NaturalGrass:
1037  case tov_OSetaside:
1038  score = 4;
1039  if (m_TheLandscape->SupplyVegPatchy(a_field)) score+=2;
1040  break;
1041 
1042  case tov_Undefined:
1043  default:
1044  return 0;
1045  }
1046  return score;
1047 }
bool SupplyVegPatchy(int a_polyref)
Definition: landscape.h:986
TTypesOfVegetation
Definition: tov_declaration.h:30
@ tov_WWheatPControl
Definition: tov_declaration.h:55
@ tov_OWinterWheatUndersown
Definition: tov_declaration.h:49
@ tov_BroadBeans
Definition: tov_declaration.h:66
@ tov_PermanentGrassGrazed
Definition: tov_declaration.h:49
@ tov_SpringBarleySKManagement
Definition: tov_declaration.h:65
@ tov_OFieldPeas
Definition: tov_declaration.h:43
@ tov_SpringBarleyPTreatment
Definition: tov_declaration.h:63
@ tov_OSpringBarleyPigs
Definition: tov_declaration.h:47
@ tov_WWheatPTreatment
Definition: tov_declaration.h:55
@ tov_PermanentSetaside
Definition: tov_declaration.h:49
@ tov_FodderGrass
Definition: tov_declaration.h:62
@ tov_SeedGrass1
Definition: tov_declaration.h:50
@ tov_OGrazingPigs
Definition: tov_declaration.h:44
@ tov_NoGrowth
Definition: tov_declaration.h:38
@ tov_CloverGrassGrazed2
Definition: tov_declaration.h:33
@ tov_OSpringBarley
Definition: tov_declaration.h:46
@ tov_PotatoesIndustry
Definition: tov_declaration.h:50
@ tov_PermanentGrassTussocky
Definition: tov_declaration.h:49
@ tov_OSpringBarleyExt
Definition: tov_declaration.h:63
@ tov_OFirstYearDanger
Definition: tov_declaration.h:44
@ tov_OWinterRape
Definition: tov_declaration.h:47
@ tov_OPotatoes
Definition: tov_declaration.h:44
@ tov_WinterRape
Definition: tov_declaration.h:53
@ tov_OPermanentGrassGrazed
Definition: tov_declaration.h:44
@ tov_SpringBarley
Definition: tov_declaration.h:52
@ tov_OWinterBarley
Definition: tov_declaration.h:47
@ tov_OSeedGrass1
Definition: tov_declaration.h:46
@ tov_SpringBarleySilage
Definition: tov_declaration.h:52
@ tov_SpringBarleySeed
Definition: tov_declaration.h:52
@ tov_SpringBarleyCloverGrass
Definition: tov_declaration.h:52
@ tov_Carrots
Definition: tov_declaration.h:31
@ tov_FieldPeas
Definition: tov_declaration.h:34
@ tov_WWheatPToxicControl
Definition: tov_declaration.h:55
@ tov_OTriticale
Definition: tov_declaration.h:47
@ tov_Triticale
Definition: tov_declaration.h:53
@ tov_OFodderBeet
Definition: tov_declaration.h:65
@ tov_WinterWheat
Definition: tov_declaration.h:55
@ tov_OCarrots
Definition: tov_declaration.h:43
@ tov_OSBarleySilage
Definition: tov_declaration.h:56
@ tov_SpringWheat
Definition: tov_declaration.h:53
@ tov_SeedGrass2
Definition: tov_declaration.h:50
@ tov_Undefined
Definition: tov_declaration.h:114
@ tov_OFieldPeasSilage
Definition: tov_declaration.h:56
@ tov_SugarBeet
Definition: tov_declaration.h:66
@ tov_PermanentGrassLowYield
Definition: tov_declaration.h:63
@ tov_CloverGrassGrazed1
Definition: tov_declaration.h:32
@ tov_SpringRape
Definition: tov_declaration.h:53
@ tov_SpringBarleySpr
Definition: tov_declaration.h:66
@ tov_OSeedGrass2
Definition: tov_declaration.h:46
@ tov_NaturalGrass
Definition: tov_declaration.h:37
@ tov_Oats
Definition: tov_declaration.h:40
@ tov_OBarleyPeaCloverGrass
Definition: tov_declaration.h:41
@ tov_Maize
Definition: tov_declaration.h:36
@ tov_OSpringBarleyClover
Definition: tov_declaration.h:46
@ tov_OCloverGrassSilage1
Definition: tov_declaration.h:43
@ tov_OCloverGrassGrazed2
Definition: tov_declaration.h:43
@ tov_Potatoes
Definition: tov_declaration.h:50
@ tov_None
Definition: tov_declaration.h:39
@ tov_Setaside
Definition: tov_declaration.h:50
@ tov_OSpringBarleyGrass
Definition: tov_declaration.h:46
@ tov_OWinterWheat
Definition: tov_declaration.h:66
@ tov_OWinterBarleyExt
Definition: tov_declaration.h:65
@ tov_OWinterRye
Definition: tov_declaration.h:49
@ tov_OOats
Definition: tov_declaration.h:44
@ tov_Heath
Definition: tov_declaration.h:66
@ tov_OCloverGrassGrazed1
Definition: tov_declaration.h:43
@ tov_WinterRye
Definition: tov_declaration.h:55
@ tov_FodderBeet
Definition: tov_declaration.h:35
@ tov_SpringBarleyGrass
Definition: tov_declaration.h:52
@ tov_WinterBarley
Definition: tov_declaration.h:53
@ tov_WinterWheatShort
Definition: tov_declaration.h:56
@ tov_YoungForest
Definition: tov_declaration.h:60
@ tov_AgroChemIndustryCereal
Definition: tov_declaration.h:55
@ tov_OSetaside
Definition: tov_declaration.h:46

References Population_Manager::m_TheLandscape, Landscape::SupplyVegPatchy(), Landscape::SupplyVegType(), tov_AgroChemIndustryCereal, tov_BroadBeans, tov_Carrots, tov_CloverGrassGrazed1, tov_CloverGrassGrazed2, tov_FieldPeas, tov_FodderBeet, tov_FodderGrass, tov_Heath, tov_Maize, tov_NaturalGrass, tov_NoGrowth, tov_None, tov_Oats, tov_OBarleyPeaCloverGrass, tov_OCarrots, tov_OCloverGrassGrazed1, tov_OCloverGrassGrazed2, tov_OCloverGrassSilage1, tov_OFieldPeas, tov_OFieldPeasSilage, tov_OFirstYearDanger, tov_OFodderBeet, tov_OGrazingPigs, tov_OOats, tov_OPermanentGrassGrazed, tov_OPotatoes, tov_OSBarleySilage, tov_OSeedGrass1, tov_OSeedGrass2, tov_OSetaside, tov_OSpringBarley, tov_OSpringBarleyClover, tov_OSpringBarleyExt, tov_OSpringBarleyGrass, tov_OSpringBarleyPigs, tov_OTriticale, tov_OWinterBarley, tov_OWinterBarleyExt, tov_OWinterRape, tov_OWinterRye, tov_OWinterWheat, tov_OWinterWheatUndersown, tov_PermanentGrassGrazed, tov_PermanentGrassLowYield, tov_PermanentGrassTussocky, tov_PermanentSetaside, tov_Potatoes, tov_PotatoesIndustry, tov_SeedGrass1, tov_SeedGrass2, tov_Setaside, tov_SpringBarley, tov_SpringBarleyCloverGrass, tov_SpringBarleyGrass, tov_SpringBarleyPTreatment, tov_SpringBarleySeed, tov_SpringBarleySilage, tov_SpringBarleySKManagement, tov_SpringBarleySpr, tov_SpringRape, tov_SpringWheat, tov_SugarBeet, tov_Triticale, tov_Undefined, tov_WinterBarley, tov_WinterRape, tov_WinterRye, tov_WinterWheat, tov_WinterWheatShort, tov_WWheatPControl, tov_WWheatPToxicControl, tov_WWheatPTreatment, and tov_YoungForest.

Referenced by EvalHabitatQual().

◆ Hunting()

void Partridge_Population_Manager::Hunting ( int  p_chance)
private

Global hunting.

Implements a global mortality probability per bird on a single day of the year. Only adults and Chick2 objects are affected.

1117 {
1118  unsigned size2 = (unsigned) TheArray[pob_Female].size();
1119  for ( unsigned j = 0; j < size2; j++ )
1120  {
1121  if ( random( 10000 ) < p_chance )
1122  {
1123  if (TheArray[pob_Female] [j]->GetCurrentStateNo() != -1) {
1124  TheArray[pob_Female] [j]->Dying();
1127  }
1128  }
1129  }
1130  size2 = (unsigned) TheArray[pob_Male].size();
1131  for ( unsigned j = 0; j < size2; j++ )
1132  {
1133  if ( random( 10000 ) < p_chance )
1134  {
1135  if (TheArray[pob_Male] [j]->GetCurrentStateNo() != -1) {
1136  TheArray[pob_Male] [j]->Dying();
1138  }
1139  }
1140  }
1141  size2 = (unsigned) TheArray[pob_Chick2].size();
1142  for ( unsigned j = 0; j < size2; j++ )
1143  { if (size2>0) {
1144  if ( random( 10000 ) < p_chance )
1145  {
1146  if (TheArray[pob_Chick2] [j]->GetCurrentStateNo() != -1) {
1147  TheArray[pob_Chick2] [j]->Dying();
1149  }
1150  }
1151  }
1152  }
1153 }
void incNoShotBirds()
Definition: Partridge_All.h:180
void incNoShotFemales()
Definition: Partridge_All.h:184

References population_attributes::incNoShotBirds(), population_attributes::incNoShotFemales(), m_Ourkfactors, k_factors::m_ThisYear, pob_Chick2, pob_Female, pob_Male, random(), and Population_Manager::TheArray.

Referenced by DoAfter().

◆ HuntingDifferentiatedBeetleBankArea()

void Partridge_Population_Manager::HuntingDifferentiatedBeetleBankArea ( int  a_pct)
private

Differentiated hunting in beetlebank areas.

Differential hunting inside a specific area designated as beetlebank addition area. Takes a fixed proportion of the population (input variable for inside and outside), in the middle of the hunting season

1205 {
1206  int tx1 = cfg_BeetleBankMinX.value();
1207  int tx2 = cfg_BeetleBankMaxX.value();
1208  int ty1 = cfg_BeetleBankMinY.value();
1209  int ty2 = cfg_BeetleBankMaxY.value();
1210  double huntpercent_out, huntpercent_in;
1211  if (!cfg_BeetleBankInvert.value())
1212  {
1213  huntpercent_out = a_pct;
1214  huntpercent_in =cfg_ParHuntingBeetleBankArea.value();
1215  }
1216  else
1217  {
1218  huntpercent_in = a_pct;
1219  huntpercent_out =cfg_ParHuntingBeetleBankArea.value();
1220  }
1221  for (int pob=(int)pob_Chick2; pob<=(int)pob_Female; pob++)
1222  {
1223  unsigned size2 = (unsigned) TheArray[pob].size();
1224  for ( unsigned j = 0; j < size2; j++ )
1225  {
1226  if (TheArray[pob] [j]->GetCurrentStateNo() != -1)
1227  {
1228  APoint AnPos=TheArray[pob] [j]->SupplyPoint();
1229  if ((AnPos.m_x >= tx1) && (AnPos.m_y >= ty1) && (AnPos.m_x <= tx2) && (AnPos.m_y <= ty2))
1230  {
1231  if ( random( 10000 ) < huntpercent_in )
1232  {
1233  TheArray[pob] [j]->Dying();
1235  }
1236  }
1237  else
1238  if ( random( 10000 ) < huntpercent_out )
1239  {
1240  TheArray[pob] [j]->Dying();
1242  }
1243  }
1244  }
1245  }
1246 }
CfgBool cfg_BeetleBankInvert
CfgInt cfg_ParHuntingBeetleBankArea("PAR_HUNTING_BEETLEBANKAREA", CFG_CUSTOM, 500)
The hunting rate in beetle bank areas.
CfgInt cfg_BeetleBankMinX
CfgInt cfg_BeetleBankMaxY
CfgInt cfg_BeetleBankMinY
CfgInt cfg_BeetleBankMaxX
A simple class defining an x,y coordinate set.
Definition: ALMaSS_Setup.h:53
int m_y
Definition: ALMaSS_Setup.h:56
int m_x
Definition: ALMaSS_Setup.h:55
bool value(void)
Definition: configurator.h:135

References cfg_BeetleBankInvert, cfg_BeetleBankMaxX, cfg_BeetleBankMaxY, cfg_BeetleBankMinX, cfg_BeetleBankMinY, cfg_ParHuntingBeetleBankArea, population_attributes::incNoShotBirds(), m_Ourkfactors, k_factors::m_ThisYear, APoint::m_x, APoint::m_y, pob_Chick2, pob_Female, random(), Population_Manager::TheArray, CfgInt::value(), and CfgBool::value().

Referenced by DoAfter().

◆ HuntingGrid()

void Partridge_Population_Manager::HuntingGrid ( int  p_chance)
private

Density grid-based hunting.

The hunting pressure is applied in a grid of variable size and only when densities in the grid are above a specified threshold.

1160 {
1161  // First creates a density map of e.g. 1km squares
1162  unsigned GridSize=cfg_ParHuntingGridSize.value();
1163  unsigned Grids = SimW/GridSize;
1164  unsigned* densities = new unsigned[10000]; // This will allow up to 100x100 squares
1165  for (unsigned d=0; d<10000; d++) densities[d]=0;
1166  for (int pob=(int)pob_Chick2; pob<=(int)pob_Female; pob++) {
1167  unsigned size2 = (unsigned) TheArray[pob].size();
1168  for ( unsigned j = 0; j < size2; j++ ) {
1169  if (TheArray[pob] [j]->GetCurrentStateNo() != -1) {
1170  AnimalPosition AnPos=TheArray[pob] [j]->SupplyPosition();
1171  unsigned sqx=AnPos.m_x/GridSize;
1172  unsigned sqy=AnPos.m_y/GridSize;
1173  densities[(sqy*Grids)+sqx]++;
1174  }
1175  }
1176  }
1177  // Now go through and apply hunting
1178  unsigned ParHuntingThreshold=cfg_ParHuntingThreshold.value();
1179  for (int pob=(int)pob_Chick2; pob<=(int)pob_Female; pob++) {
1180  unsigned size2 = (unsigned) TheArray[pob].size();
1181  for ( unsigned j = 0; j < size2; j++ ) {
1182  if ( random( 10000 ) < p_chance ) {
1183  if (TheArray[pob] [j]->GetCurrentStateNo() != -1) {
1184  AnimalPosition AnPos=TheArray[pob] [j]->SupplyPosition();
1185  unsigned sqx=AnPos.m_x/GridSize;
1186  unsigned sqy=AnPos.m_y/GridSize;
1187  if (densities[(sqy*Grids)+sqx]>ParHuntingThreshold) {
1188  if ( random( 10000 ) < p_chance ) {
1189  TheArray[pob] [j]->Dying();
1191  }
1192  }
1193  }
1194  }
1195  }
1196  }
1197  delete[] densities;
1198 }
static CfgInt cfg_ParHuntingThreshold("PAR_HUNTINGTHRESHOLD", CFG_CUSTOM, 1)
Number of birds at which hunting starts.
static CfgInt cfg_ParHuntingGridSize("PAR_HUNTINGGRIDSIZE", CFG_CUSTOM, 1000)
Size if hunting grid (m)
int SimW
Definition: PopulationManager.h:511

References cfg_ParHuntingGridSize, cfg_ParHuntingThreshold, population_attributes::incNoShotBirds(), m_Ourkfactors, k_factors::m_ThisYear, AnimalPosition::m_x, AnimalPosition::m_y, pob_Chick2, pob_Female, random(), Population_Manager::SimW, Population_Manager::TheArray, and CfgInt::value().

Referenced by DoAfter().

◆ Init()

void Partridge_Population_Manager::Init ( void  )
virtual


208 {
209  if ( cfg_RipleysOutput_used.value() ) {
211  }
214  } else ReallyBigOutputPrb=0;
215  // autom. called by constructor
216  strcpy( m_SimulationName, "Partridge Simulation" );
217  m_Partridge_IDs = 0;
218  // Create some male and female Partridges
220  for ( int i = 0; i < num; i++ )
221  {
223  }
224  for ( int i = 0; i < cfg_StartingNumberFemalePartridges.value(); i++ )
225  {
227  }
228 
229  // Load List of Animal Classes
230  m_ListNames[0] = "Clutch";
231  m_ListNames[1] = "Chick";
232  m_ListNames[2] = "Chick2";
233  m_ListNames[3] = "Male";
234  m_ListNames[4] = "Female";
235  m_ListNames[5] = "Covey";
236  m_ListNameLength = 6;
238 
239  // Load State Names
240  StateNames[pars_Initiation] = "ALL Initiation";
241  StateNames[pars_CMoving] = "Clutch Moving";
242  StateNames[pars_ClDeveloping] = "Clutch Developing";
243  StateNames[pars_ClHatching] = "Clutch Hatching";
244  StateNames[pars_ClDying] = "Clutch Dying";
245  StateNames[pars_ChDeveloping] = "Chick_Developing";
246  StateNames[pars_ChMaturing] = "Chick_Maturing";
247  StateNames[pars_ChDying] = "Chick_Dying";
248  StateNames[pars_MFlocking] = "Male Flocking";
249  StateNames[pars_MFindingMate] = "Male Finding Mate";
250  StateNames[pars_MFollowingMate] = "Male Following Mate";
251  StateNames[pars_MPairing] = "Male Pairing";
252  StateNames[pars_MGuardingMate] = "Male Guarding Mate";
253  StateNames[pars_MCaringForYoung] = "Male Caring For Young";
254  StateNames[pars_MDying] = "Male Dying";
255  StateNames[pars_FFlocking] = "Female Flocking";
256  StateNames[pars_FFindingTerritory] = "Female Finding Territory";
257  StateNames[pars_FAttractingMate] = "Female Attracting A Mate";
258  StateNames[pars_FBuildingUpResources] = "Female Building Up Resources";
259  StateNames[pars_FMakingNest] = "Female Making Nest";
260  StateNames[pars_FLaying] = "Female Laying";
261  StateNames[pars_FStartingNewBrood] = "Female Starting New Brood";
262  StateNames[pars_FIncubating] = "Female Incubating";
263  StateNames[pars_FCaringForYoung] = "Female Caring For Young";
264  StateNames[pars_FDying] = "Female Dying";
265  StateNames[pars_CoveyDissolve] = "Covey Dissolve";
266  StateNames[pars_CoveyBeing] = "Covey Exists";
267  StateNames[pars_Destroy] = "ALL Destroy";
268  StateNamesLength = 28;
269  // determine whether we should shuffle, or sort or do nothing to Partridges
270  // after each time step.
271  BeforeStepActions[0] = 3; // 0 = Shuffle, 1 = SortX, 2 = SortY, 3 = do nothing
272  BeforeStepActions[1] = 3; // 0 = Shuffle, 1 = SortX, 2 = SortY, 3 = do nothing
273 
274  BeforeStepActions[2] = 0; // 0 = Shuffle, 1 = SortX, 2 = SortY, 3 = do nothing
275  BeforeStepActions[3] = 0; // 0 = Shuffle, 1 = SortX, 2 = SortY, 3 = do nothing
276  BeforeStepActions[4] = 0; // 0 = Shuffle, 1 = SortX, 2 = SortY, 3 = do nothing
277  BeforeStepActions[5] = 0; // 0 = Shuffle, 1 = SortX, 2 = SortY, 3 = do nothing
278 
279  // They all start flocking
280  m_ShouldFlock = true;
281 
282  // OPen the output files
283  m_HatchSuccess = 0;
284  if ( !OpenParOutputFiles() )
285  {
286  m_TheLandscape->Warn( "Partridge_Pop_Man::Init(): ""Problem opening output files", "" );
287  exit( 1 );
288  }
289 #ifdef __NESTPOSITIONS_OUT
290 NestPositions=fopen("NestPositions.txt","w");
291  if ( !NestPositions )
292  {
293  g_msg->Warn( WARN_BUG, "Partridge_Population_Manager::Init(): Cannot open NestPositions.txt file", "" );
294  exit( 1 );
295  }
296 #endif
297  // [Height][Biomass]
298 /*
299 FILE * HBdata = fopen("HB_impedence_18072010.txt", "r" );
300  if ( !HBdata )
301  {
302  g_msg->Warn( WARN_BUG, "Partridge_Population_Manager::Init(): Cannot open HBdata file", "" );
303  exit( 1 );
304  }
305  double d;
306  float f;
307  double sc = cfg_HindranceScalingFactor.value();
308  for ( int h = 0; h < 4; h++ )
309  for ( int b = 0; b < 4; b++ )
310  {
311  fscanf( HBdata, "%g\n", & f );
312  FloatToDouble(d,f);
313  //SetMoveVegStructure(h,b,d);
314  d += ( 1.0 - d ) / sc;
315  g_move_veg_structure[h] [b] = d;
316  }
317  fclose( HBdata );
318 */
319  FillInFoodArray();
320  // Create analysis objects
321  m_Ourkfactors = new k_factors;
322  m_Ourkfactors->m_ThisYear->setNoMalesSept( 100000000 ); // this is just to avoid log error in the first year
324  // Need to create and fill in the density maps
327  m_maxx = lx / 10;
328  m_maxy = ly / 10;
329  m_halfwidth = lx / 2;
330  m_territoryqualmap = new CoverTempMap(lx,ly);
331  m_nestingcovermap = new CoverTempMap(lx,ly);
334 
335  // Added by Krishnan Sudharsan March 22 2007 and March 23 2007
336  m_HabitatQuality[0]=0;
338  double alpha_max = 4.00000; // Maximum power value
339  double alpha_min = 0.00000; // Minimum power value
340  double alpha_medium = (alpha_max + alpha_min) / 2; // Changing value of mid point
341  double m_medium_tq = cfg_par_max_terr_qual.value() - pow(daydiff, alpha_medium); // Territory quality when power is intermediate
342  // the range of territory quality within which our target has to be
343  double range_min = cfg_par_min_terr_qual.value()- cfg_par_min_terr_qual.value()* 0.01;
344  double range_max = cfg_par_min_terr_qual.value()+ cfg_par_min_terr_qual.value()* 0.01;
345 
346  // Search value has to be equal to territory minimum value at end
347  // Binary search to find the power that decreases TQ from max to min in given days
348  // Continue searching till the search value equals the minimum territory value.
349  // Stop when the search value = t_min. Time at this point = daydiff.
350  while (m_medium_tq < range_min || m_medium_tq > range_max)
351  {
352  if (m_medium_tq < range_min){
353  alpha_max = alpha_medium ;
354  alpha_medium = (alpha_min + alpha_max) / 2;}
355  else {
356  alpha_min = alpha_medium;
357  alpha_medium = (alpha_min + alpha_max) / 2;}
358  m_medium_tq = cfg_par_max_terr_qual.value() - pow(daydiff, alpha_medium);
359  }
360  // For sake of safety I added 1 extra day for the territoryquality assessment
361  for (int i = 0; i < daydiff+1; i++){
362  m_HabitatQuality[i] = cfg_par_max_terr_qual.value() - pow(i,alpha_medium);}
363 
364 }
@ pars_FLaying
Definition: Partridge_All.h:282
@ pars_FBuildingUpResources
Definition: Partridge_All.h:282
@ pars_ClDeveloping
Definition: Partridge_All.h:273
@ pars_CoveyBeing
Definition: Partridge_All.h:285
@ pars_MFlocking
Definition: Partridge_All.h:279
@ pars_MCaringForYoung
Definition: Partridge_All.h:279
@ pars_FAttractingMate
Definition: Partridge_All.h:283
@ pars_FCaringForYoung
Definition: Partridge_All.h:283
@ pars_FIncubating
Definition: Partridge_All.h:283
@ pars_ChDeveloping
Definition: Partridge_All.h:276
@ pars_MFollowingMate
Definition: Partridge_All.h:279
@ pars_MFindingMate
Definition: Partridge_All.h:279
@ pars_FFlocking
Definition: Partridge_All.h:282
@ pars_MPairing
Definition: Partridge_All.h:279
@ pars_FMakingNest
Definition: Partridge_All.h:282
@ pars_MGuardingMate
Definition: Partridge_All.h:279
@ pars_FStartingNewBrood
Definition: Partridge_All.h:282
@ pars_CMoving
Definition: Partridge_All.h:270
@ pars_ChMaturing
Definition: Partridge_All.h:276
@ pars_Initiation
Definition: Partridge_All.h:267
@ pars_ChDying
Definition: Partridge_All.h:276
@ pars_ClDying
Definition: Partridge_All.h:273
@ pars_CoveyDissolve
Definition: Partridge_All.h:285
@ pars_FFindingTerritory
Definition: Partridge_All.h:282
@ pars_ClHatching
Definition: Partridge_All.h:273
CfgInt cfg_par_max_terr_qual
CfgInt cfg_par_last_brood_date
CfgBool cfg_ReallyBigOutput_used
static CfgInt cfg_StartingNumberMalePartridges("PAR_STARTING_NO_MALES", CFG_CUSTOM, 10000)
Start no of male partridges.
double g_par_rainfactor
Definition: Partridge_Population_Manager.cpp:63
CfgInt cfg_par_min_terr_qual
CfgBool cfg_RipleysOutput_used
static CfgFloat cfg_par_rainfactor("PAR_RAINFACTOR", CFG_CUSTOM, 0.2)
Increase in energy requirement with rainfall.
static CfgInt cfg_StartingNumberFemalePartridges("PAR_STARTING_NO_FEMALES", CFG_CUSTOM, 10000)
Start no of female partridges.
@ TOP_Partridge
Definition: PopulationManager.h:65
void CreateNestingCoverDensityMap()
Intitialises the nesting cover map.
Definition: Partridge_Population_Manager.cpp:778
void CreateInitialObjects(int ob_type, int number)
Definition: Partridge_Population_Manager.cpp:465
bool OpenParOutputFiles()
Opens the partridge output files.
Definition: Partridge_Population_Manager.cpp:1612
bool m_ShouldFlock
Flag for flocking or not.
Definition: Partridge_Population_Manager.h:123
void FillInFoodArray()
Precalculated food values with age.
Definition: Partridge_Population_Manager.cpp:1390
FILE * ReallyBigOutputPrb
Definition: PopulationManager.h:595
const char * m_ListNames[32]
Definition: PopulationManager.h:537
char m_SimulationName[255]
Definition: PopulationManager.h:513
unsigned BeforeStepActions[12]
Definition: PopulationManager.h:542
const char * StateNames[100]
Definition: PopulationManager.h:531
bool OpenTheRipleysOutputProbe(string a_NWordFilename)
Definition: PopulationManager.cpp:757
unsigned m_ListNameLength
Definition: PopulationManager.h:538
TTypesOfPopulation m_population_type
Definition: PopulationManager.h:580
bool OpenTheReallyBigProbe()
Definition: PopulationManager.cpp:859
unsigned StateNamesLength
Definition: PopulationManager.h:535
Class for calculating k-factors.
Definition: Partridge_All.h:235
void CreateInfoDatabaseFile()
Definition: Partridge_All.cpp:3145

References Population_Manager::BeforeStepActions, cfg_par_last_brood_date, cfg_par_max_terr_qual, cfg_par_min_terr_qual, cfg_par_rainfactor, cfg_par_start_dissolve, cfg_ReallyBigOutput_used, cfg_RipleysOutput_used, cfg_StartingNumberFemalePartridges, cfg_StartingNumberMalePartridges, k_factors::CreateInfoDatabaseFile(), CreateInitialObjects(), CreateNestingCoverDensityMap(), FillInFoodArray(), g_msg, g_par_rainfactor, m_HabitatQuality, m_halfwidth, m_HatchSuccess, Population_Manager::m_ListNameLength, Population_Manager::m_ListNames, m_maxx, m_maxy, m_nestingcovermap, m_Ourkfactors, m_Partridge_IDs, Population_Manager::m_population_type, m_ShouldFlock, Population_Manager::m_SimulationName, m_territoryqualmap, Population_Manager::m_TheLandscape, k_factors::m_ThisYear, OpenParOutputFiles(), Population_Manager::OpenTheReallyBigProbe(), Population_Manager::OpenTheRipleysOutputProbe(), pars_ChDeveloping, pars_ChDying, pars_ChMaturing, pars_ClDeveloping, pars_ClDying, pars_ClHatching, pars_CMoving, pars_CoveyBeing, pars_CoveyDissolve, pars_Destroy, pars_FAttractingMate, pars_FBuildingUpResources, pars_FCaringForYoung, pars_FDying, pars_FFindingTerritory, pars_FFlocking, pars_FIncubating, pars_FLaying, pars_FMakingNest, pars_FStartingNewBrood, pars_Initiation, pars_MCaringForYoung, pars_MDying, pars_MFindingMate, pars_MFlocking, pars_MFollowingMate, pars_MGuardingMate, pars_MPairing, pob_Female, pob_Male, Population_Manager::ReallyBigOutputPrb, population_attributes::setNoMalesSept(), Population_Manager::StateNames, Population_Manager::StateNamesLength, Landscape::SupplySimAreaHeight(), Landscape::SupplySimAreaWidth(), TOP_Partridge, CfgInt::value(), CfgFloat::value(), CfgBool::value(), MapErrorMsg::Warn(), Landscape::Warn(), and WARN_BUG.

Referenced by Partridge_Population_Manager().

◆ MaleImmigration()

void Partridge_Population_Manager::MaleImmigration ( void  )
private

If male immigration is needed - Unused.

Unused at present

1813  {
1814  //
1815  // First do we have the right day?
1816  int today = m_TheLandscape->SupplyDayInYear();
1817  if (today!=212) return;
1818 
1819  // Now if the % decrease is higher or lower than 100 we need to do different things
1820  int esize=cfg_MaleImmigration.value();
1821  if (esize<1) return; // why waste time if there is nothing to do
1822  Partridge_Base* PB = NULL;
1823  // This is a tricky thing to do because we need to duplicate birds, but dare not mess
1824  // mate pointers etc up.
1825  // This also requires a copy method in the target birds
1826  // esize also needs translating 120 = 20%, 200 = 100%
1827  unsigned size2;
1828  size2 = (unsigned) TheArray[ pob_Male ].size();
1829  for ( unsigned j = 0; j < size2; j++ ) {
1830  if (random(100) < esize) {
1831  PB = dynamic_cast < Partridge_Base * > ( TheArray[ pob_Male ] [ j ] );
1832  PB->CopyMyself(pob_Male); // Duplicate it
1833  }
1834  }
1835 }
static CfgInt cfg_MaleImmigration("PAR_MALEIMMIGRATION", CFG_CUSTOM, 0)
unused

References cfg_MaleImmigration, Partridge_Base::CopyMyself(), Population_Manager::m_TheLandscape, pob_Male, random(), Landscape::SupplyDayInYear(), Population_Manager::TheArray, and CfgInt::value().

◆ ObjectLoopFetch()

TAnimal * Partridge_Population_Manager::ObjectLoopFetch ( void  )


197 {
198 
199  if ( m_loop_index >= m_loop_limit )
200  return NULL;
201 
203 }
unsigned int m_loop_index
Definition: Partridge_Population_Manager.h:110
int m_loop_ob_type
Definition: Partridge_Population_Manager.h:114
unsigned int m_loop_limit
Definition: Partridge_Population_Manager.h:112

References m_loop_index, m_loop_limit, m_loop_ob_type, and Population_Manager::TheArray.

Referenced by Partridge_Covey::FindMateInArea().

◆ ObjectLoopInit()

void Partridge_Population_Manager::ObjectLoopInit ( int  ob_type)


188 {
189  m_loop_index = 0;
190  m_loop_ob_type = ob_type;
191  m_loop_limit = (int)TheArray[ob_type].size();
192 }

References m_loop_index, m_loop_limit, m_loop_ob_type, and Population_Manager::TheArray.

Referenced by Partridge_Covey::FindMateInArea().

◆ OpenParOutputFiles()

bool Partridge_Population_Manager::OpenParOutputFiles ( )
private

Opens the partridge output files.

1613 {
1614  ParAdMort = fopen("ParAdMort.txt", "w" );
1615  if ( !ParAdMort ) return false;
1616  ParJuvMort = fopen("ParJuvMort.txt", "w" );
1617  if ( !ParJuvMort ) return false;
1618  ParNoB = fopen("ParNoB.txt", "w" );
1619  if ( !ParNoB ) return false;
1620  ParClutches = fopen("ParClutches.txt", "w" );
1621  if ( !ParClutches ) return false;
1622  ParFlocks = fopen("ParFlocks.txt", "w" );
1623  if ( !ParFlocks ) return false;
1624  ParUnpairedMale = fopen("ParUnpairedMale.txt", "w" );
1625  if ( !ParUnpairedMale ) return false;
1626  NoHatchedPerYear = fopen("NoHatchedPerYear.txt", "w" );
1627  if ( !NoHatchedPerYear ) return false;
1628  return true;
1629 }

References NoHatchedPerYear, ParAdMort, ParClutches, ParFlocks, ParJuvMort, ParNoB, and ParUnpairedMale.

Referenced by Init().

◆ SupplyCovPosx()

int Partridge_Population_Manager::SupplyCovPosx ( int  j)
inlinevirtual


Reimplemented from Population_Manager.

243  {
244  return dynamic_cast < Partridge_Covey * > ( TheArray[ pob_Covey ] [ j ] )->XCenter();
245  };

References pob_Covey, and Population_Manager::TheArray.

◆ SupplyCovPosy()

int Partridge_Population_Manager::SupplyCovPosy ( int  j)
inlinevirtual


Reimplemented from Population_Manager.

248  {
249  return dynamic_cast < Partridge_Covey * > ( TheArray[ pob_Covey ] [ j ] )->YCenter();
250  };

References pob_Covey, and Population_Manager::TheArray.

◆ SupplyPegPosx()

int Partridge_Population_Manager::SupplyPegPosx ( int  j)
inlinevirtual


Reimplemented from Population_Manager.

233  {
234  return dynamic_cast < Partridge_Covey * > ( TheArray[ pob_Covey ] [ j ] )->X();
235  };

References pob_Covey, and Population_Manager::TheArray.

◆ SupplyPegPosy()

int Partridge_Population_Manager::SupplyPegPosy ( int  j)
inlinevirtual


Reimplemented from Population_Manager.

238  {
239  return dynamic_cast < Partridge_Covey * > ( TheArray[ pob_Covey ] [ j ] )->Y();
240  };

References pob_Covey, and Population_Manager::TheArray.

◆ SupplyShouldFlock()

bool Partridge_Population_Manager::SupplyShouldFlock ( )
inline

◆ TerrEvalPoly()

double Partridge_Population_Manager::TerrEvalPoly ( TTypesOfLandscapeElement  a_cet,
int  a_poly 
)

Habitat evaluation.

◆ TestShouldFlock()

void Partridge_Population_Manager::TestShouldFlock ( )
private

Should the birds start to flock?

Called every day. The aim here is to get covey dissolve after a spedified date, and reflocking after a later date.

1436 {
1437  int today = m_TheLandscape->SupplyDayInYear();
1438  if ( ( m_ShouldFlock ) && ( today > cfg_par_start_dissolve.value() ) && ( today < 150 ) && ( CoveyDissolveWeather() ) )
1439  {
1440  m_ShouldFlock = false;
1441  // Now need to tell the coveys to pair the birds
1442  // and break up
1443  //
1444  int si = (int) TheArray[pob_Covey].size();
1445  for ( int i = 0; i < si; i++ )
1446  {
1447  // Generate a date to dissolve
1448  // Just make sure it is not too late
1449  if ( today > 80 ) today = 80;
1450  dynamic_cast < Partridge_Covey * > ( TheArray[pob_Covey] [i] )->OnDissolve( today );
1451  }
1452  }
1453  if ( today >= cfg_par_male_gives_up.value() ) m_ShouldFlock = true;
1454 }
bool CoveyDissolveWeather()
Definition: Partridge_Population_Manager.cpp:1422

References cfg_par_male_gives_up, cfg_par_start_dissolve, CoveyDissolveWeather(), m_ShouldFlock, Population_Manager::m_TheLandscape, pob_Covey, Landscape::SupplyDayInYear(), Population_Manager::TheArray, and CfgInt::value().

Referenced by DoFirst().

◆ TheAOROutputProbe()

void Partridge_Population_Manager::TheAOROutputProbe ( )
virtual

Output method.

Reimplemented from Population_Manager.

1705  {
1707 }
virtual void DoProbe(int a_lifestage)
Definition: AOR_Probe.cpp:59
AOR_Probe * m_AOR_Probe
Definition: PopulationManager.h:526

References AOR_Probe::DoProbe(), Population_Manager::m_AOR_Probe, and pob_Female.

◆ TheRipleysOutputProbe()

void Partridge_Population_Manager::TheRipleysOutputProbe ( FILE *  a_prb)
virtual

Output method.

An output designed to be used as an input to calculating Ripley's k in R.

Reimplemented from Population_Manager.

1713  {
1714  Partridge_Female* FS;
1715  unsigned totalF=(unsigned) TheArray[pob_Female].size();
1716  int x,y;
1719  fprintf(a_prb,"%d %d %d %d %d\n", 0,w ,0, h, totalF);
1720  for (unsigned j=0; j<totalF; j++) //adult females
1721  {
1722  FS=dynamic_cast<Partridge_Female*>(TheArray[pob_Female][j]);
1723  x=FS->Supply_m_Location_x();
1724  y=FS->Supply_m_Location_y();
1725  fprintf(a_prb,"%d\t%d\n", x,y);
1726  }
1727  fflush(a_prb);
1728 }

References Population_Manager::m_TheLandscape, pob_Female, TAnimal::Supply_m_Location_x(), TAnimal::Supply_m_Location_y(), Landscape::SupplySimAreaWidth(), and Population_Manager::TheArray.

◆ UpdateNestingCoverMap()

void Partridge_Population_Manager::UpdateNestingCoverMap ( )


1085 {
1086  int lx = m_TheLandscape->SupplySimAreaWidth();
1087  int ly = m_TheLandscape->SupplySimAreaHeight();
1090  int oldref=-9999;
1091  double q=0;
1092  for ( int i = 0; i < lx; i++ )
1093  {
1094  for ( int j = 0; j < ly; j++ )
1095  {
1096  int nref = m_TheLandscape->SupplyPolyRef( i, j );
1097  if (nref==oldref) {
1098  m_territoryqualmap->AddQual(i,j,q);
1099  }
1100  else {
1101  tole = m_TheLandscape->SupplyElementType( i, j );
1102  // Add the value of this cell to the qualmap
1103  q = EvalHabitatQual( tole, m_TheLandscape->SupplyPolyRef( i, j ) ); // Uses the covey function in Partridge_Tuning.cpp via m_OurSpecialCovey;
1104  m_territoryqualmap->AddQual(i,j,q);
1105  oldref=nref;
1106  }
1107  }
1108  }
1109 }

References CoverTempMap::AddQual(), EvalHabitatQual(), m_territoryqualmap, Population_Manager::m_TheLandscape, Landscape::SupplyElementType(), Landscape::SupplyPolyRef(), Landscape::SupplySimAreaHeight(), Landscape::SupplySimAreaWidth(), and CoverTempMap::ZeroQual().

Referenced by DoFirst().

◆ WriteNoHatchedPerYear()

void Partridge_Population_Manager::WriteNoHatchedPerYear ( int  a_min,
int  a_num 
)

Output method.

1697 {
1698  fprintf( NoHatchedPerYear, "%d %d\n", a_min, a_num );
1699  fflush( NoHatchedPerYear );
1700 }

References NoHatchedPerYear.

Referenced by DoAlmostLast().

◆ WriteParAdMort()

void Partridge_Population_Manager::WriteParAdMort ( int  a_min,
int  a_age,
int  a_sex,
int  a_cause 
)

Output method.

1659 {
1660  fprintf( ParAdMort, "%d %d %d %d\n", a_min, a_age, a_sex, a_cause );
1661  // fflush(ParAdMort);
1662 }

References ParAdMort.

◆ WriteParClutches()

void Partridge_Population_Manager::WriteParClutches ( int  a_min,
int  a_num1,
int  a_num2 
)

Output method.

1683 {
1684  fprintf( ParClutches, "%d\t%d\t%d\n", a_min, a_num1, a_num2 );
1685  // fflush(ParClutches);
1686 }

References ParClutches.

Referenced by Partridge_Female::FLaying().

◆ WriteParFlocks()

void Partridge_Population_Manager::WriteParFlocks ( int  a_min,
int  a_size,
int  a_young 
)

Output method.

1689 {
1690  fprintf( ParFlocks, "%d %d %d\n", a_min, a_size, a_young );
1691  fflush( ParFlocks );
1692 }

References ParFlocks.

Referenced by DoAlmostLast().

◆ WriteParJuvMort()

void Partridge_Population_Manager::WriteParJuvMort ( int  yr,
int  a_min,
int  a_age,
int  a_cause 
)

Output method.

1665 {
1666  fprintf( ParJuvMort, "%d\t%d\t%d\t%d\n", a_yr, a_min, a_age, a_cause );
1667  // fflush(ParJuvMort);
1668 }

References ParJuvMort.

◆ WriteParNoB()

void Partridge_Population_Manager::WriteParNoB ( int  a_min,
int  a_nob 
)

Output method.

1671 {
1672  fprintf( ParNoB, "%d %d\n", a_min, a_nob );
1673  fflush( ParNoB );
1674 }

References ParNoB.

Referenced by DoAlmostLast().

◆ WriteParUnpairedMale()

void Partridge_Population_Manager::WriteParUnpairedMale ( int  a_min,
int  a_num 
)

Output method.

1677 {
1678  fprintf( ParUnpairedMale, "%d %d\n", a_min, a_num );
1679  fflush( ParUnpairedMale );
1680 }

References ParUnpairedMale.

Referenced by DoAlmostLast().

Member Data Documentation

◆ bad_guys

Partridge_Male* Partridge_Population_Manager::bad_guys[500]

Debug.

Referenced by DoMaleSanityCheck().

◆ m_comms_data

◆ m_HabitatQuality

double Partridge_Population_Manager::m_HabitatQuality[300]
private

Part of habitat quality map evaluation.

Referenced by GetHabitatQuality(), and Init().

◆ m_halfwidth

int Partridge_Population_Manager::m_halfwidth
private

Referenced by ClutchDensity(), and Init().

◆ m_HatchSuccess

int Partridge_Population_Manager::m_HatchSuccess
private

No hatch success.

Referenced by AddHatchSuccess(), DoAlmostLast(), and Init().

◆ m_loop_index

unsigned int Partridge_Population_Manager::m_loop_index
private


Referenced by ObjectLoopFetch(), and ObjectLoopInit().

◆ m_loop_limit

unsigned int Partridge_Population_Manager::m_loop_limit
private


Referenced by ObjectLoopFetch(), and ObjectLoopInit().

◆ m_loop_ob_type

int Partridge_Population_Manager::m_loop_ob_type
private


Referenced by ObjectLoopFetch(), and ObjectLoopInit().

◆ m_maxx

int Partridge_Population_Manager::m_maxx
private

internal variables

Referenced by CreateNestingCoverDensityMap(), and Init().

◆ m_maxy

int Partridge_Population_Manager::m_maxy
private

◆ m_messagecentre

◆ m_nestingcovermap

CoverTempMap* Partridge_Population_Manager::m_nestingcovermap

◆ m_Ourkfactors

◆ m_Partridge_IDs

unsigned int Partridge_Population_Manager::m_Partridge_IDs
private


Referenced by GetNewID(), and Init().

◆ m_ShouldFlock

bool Partridge_Population_Manager::m_ShouldFlock
private

Flag for flocking or not.

Referenced by Init(), SupplyShouldFlock(), and TestShouldFlock().

◆ m_Starved

int Partridge_Population_Manager::m_Starved

No starvation events.

Referenced by AddStarved(), and Partridge_Population_Manager().

◆ m_territoryqualmap

CoverTempMap* Partridge_Population_Manager::m_territoryqualmap

◆ NoHatchedPerYear

FILE* Partridge_Population_Manager::NoHatchedPerYear
private

No. successful hatches per year.

Referenced by CloseParOutputFiles(), OpenParOutputFiles(), and WriteNoHatchedPerYear().

◆ ParAdMort

FILE* Partridge_Population_Manager::ParAdMort
private

Adult mortality record.

Referenced by CloseParOutputFiles(), OpenParOutputFiles(), and WriteParAdMort().

◆ ParClutches

FILE* Partridge_Population_Manager::ParClutches
private

For each clutch, clutch no. & size.

Referenced by CloseParOutputFiles(), OpenParOutputFiles(), and WriteParClutches().

◆ ParFlocks

FILE* Partridge_Population_Manager::ParFlocks
private

Covey size 1st oct, + no. chicks.

Referenced by CloseParOutputFiles(), OpenParOutputFiles(), and WriteParFlocks().

◆ ParJuvMort

FILE* Partridge_Population_Manager::ParJuvMort
private

Juvenile mortaltiy record.

Referenced by CloseParOutputFiles(), OpenParOutputFiles(), and WriteParJuvMort().

◆ ParNoB

FILE* Partridge_Population_Manager::ParNoB
private

No of breeding Pairs.

Referenced by CloseParOutputFiles(), OpenParOutputFiles(), and WriteParNoB().

◆ ParUnpairedMale

FILE* Partridge_Population_Manager::ParUnpairedMale
private

No unparied males 1st Jun.

Referenced by CloseParOutputFiles(), OpenParOutputFiles(), and WriteParUnpairedMale().


The documentation for this class was generated from the following files: